-
Posts
4,934 -
Joined
-
Days Won
321
Everything posted by Robin S
-
It's okay to use a page/template for an AJAX response, but if you're using a delayed output approach with an auto-appended main.php file then remember to disable that for your AJAX template: Edit Template > Files > Disable automatic append of file...
-
[joke]You're gonna hate underscore.js then[/joke] ?
-
@adrian, I've added a substitute getPageIndex() method to the module so the issue should be fixed in v0.1.12. Probably not as efficient as the core Traversal methods but should be okay unless you have a massive number of siblings.
- 79 replies
-
- 2
-
- breadcrumbs
- admin
-
(and 2 more)
Tagged with:
-
Thanks, seems like a core issue with Page::index(): https://github.com/processwire/processwire-issues/issues/751 Will see if I can find a workaround for the short term.
- 79 replies
-
- 1
-
- breadcrumbs
- admin
-
(and 2 more)
Tagged with:
-
@d'Hinnisdaël, thanks for the report. FieldsetClose needed to be excluded - fixed in v0.1.3.
-
In v0.1.2 I've added some warning notices in case AdminThemeUikit is installed but not in use.
-
No, AdminThemeDefault and AdminThemeReno do some crazy JS spacer stuff to equalise field heights. This module relies on the flex layout used in AdminThemeUikit. Possibly, but not sure what the point of that would be. The module already requires AdminThemeUikit in order to be installed and also clearly states that in the readme. And if you have AdminThemeUikit installed but you allow some users to choose a different theme then using this module is not going to be a good idea. Best just not to install it in that case.
-
Right you are, I overlooked that part of your post. Taking another look at it I think the issue is that you need to specify the subfield of the page you are wanting to match against. Assuming it's the title it would be: $myBlogsStart = $bl->pages->find("template=page-blog, category_relationships_conditions.title=$query, sort=title");
-
Personally speaking, when it comes to page relationships I use... Page Reference fields: regularly The Page Field Edit Links module can be very useful for creating new pages or editing pages directly from the field via a modal. And the AsmSelect inputfield option has support for modal page editing built-in. You might find the Connect Page Fields module useful for automatically creating two-way relationships. Parent/child structure: sometimes, when it makes sense. PageTable fields: rarely
-
Glad you like it. ? Done, in v0.1.1.
-
I've never actually used this module, but looking at the module code I think this will work: if(empty($options['pageTableExtended']) && empty($options['pageStack'])) throw new Wire404Exception();
-
Not sure about the selector sanitizing, but assuming category_relationships_conditions is a Page Reference field it seems like you could simplify things and avoid the issue at the same time by using the page object in the selector: foreach($page->category_relationships_conditions as $crc) { $myBlogsStart = $bl->pages->find("template=page-blog, category_relationships_conditions=$crc, sort=title"); // ...
-
I recommend using a virtual host for each local project - it avoids little issues like this and will be more consistent with how the site will operate when migrated to a remote host. It's not difficult to set up virtual hosts manually, although if you use a tool like Laragon it's an absolute breeze because it automatically creates virtual hosts for every project in the document root: https://laragon.org/docs/pretty-urls.html
-
When a page is rendered by another page PW populates a "stack" of pages that called render in an $options variable. See Ryan's comment: So if a page is accessed directly and not rendered by another page then the page stack will be empty (in fact the $options variable will not be set). So you can put the following at the top of template files that should not be directly viewable but only rendered as part of another page: if(empty($options['pageStack'])) throw new Wire404Exception();
-
It's the infinitely useful Console panel in Tracy Debugger: https://adrianbj.github.io/TracyDebugger/#/debug-bar?id=console
-
This seems like it could be reasonable solution: disable session fingerprint when a site is on localhost. That way when developing locally the user agent is allowed to change without causing a logout. In /site/config.php: if(in_array($_SERVER['SERVER_ADDR'], ['127.0.0.1', '::1'])) { $config->sessionFingerprint = false; }
-
Thanks, makes sense. So a couple of solutions would be: Use an incognito window when working with dev tools device mode. Or set $config->sessionFingerprint = false in /site/config.php These are okay but still kind of annoying. The incognito solution is a bit less convenient than working within the current browser window and easy to accidentally forget when opening view links from Page Edit / Page List. And I wouldn't want to forget the sessionFingerprint setting and leave it disabled as it reduces security a bit. I wonder if there is some way the PW session fingerprint feature could detect and allow for user agent changes that specifically come from the Chrome dev tools?
-
For some reason enabling the device mode in the Chrome developer tools logs me out of the ProcessWire admin. I'm using Windows 10, Chrome 70.0.3538.102. Steps to reproduce: 1. Login to PW admin. 2. View the site frontend in a new tab (e.g. Home page). 3. Open the Chome dev tools, enable device mode, and reload the Home page: 4. Switch to the admin tab (where dev tools is not open) and reload - you are now logged out. Can anyone else confirm this? Is there a setting in the dev tools that would avoid this? Or is this logout behaviour something that could/should be fixed in the PW core?
-
The item you want to give special treatment to is the last item in the WireArray, so you could use pop() to get that item and remove it from the WireArray: Alternatively here is a more flexible approach that you can use for any item in the WireArray:
-
Yeah, it's not clear exactly which languages are supported but the example in the docs... ...makes me think there is some non-English language support. Good solution. Thanks for adding this feature.
-
max file size validation for file/image fields
Robin S replied to chrizz's topic in Wishlist & Roadmap
Working fine here: $wire->addHookBefore('InputfieldImage::render', function(HookEvent $event) { /* @var InputfieldImage $inputfield */ $inputfield = $event->object; if($inputfield->hasField == 'image') { $inputfield->setMaxFilesize('2m'); // Set the max file size in bytes or use string like "30m", "2g" "500k" } }); But if you have client-side resizing enabled for the field that will likely interfere with the checking of the filesize before upload. -
Nice one. I have another enhancement in mind but perhaps you wouldn't agree with the premise. The default Child Template Suffix is "Items" so I guess you like to name the child templates with the plural, but to me the parent template should be plural and the child template should be singular. And ideally the singular wouldn't be created by appending the word "item" but would be a bit smarter. So if the noun is "car" then the parent template is "Cars" and the child template is "Car". And as a trickier example, if the noun is "bacterium" then the parent template is "Bacteria" and the child template is "Bacterium". An an experiment I added pluralize.js to the module and it's working great, with ProcessPageFieldSelectCreator.js consisting of: $(window).load(function() { $('#Inputfield_fieldLabel').bind('keyup change', function() { var field_label = $('#Inputfield_fieldLabel').val(); var plural = pluralize(field_label); var singular = pluralize(field_label, 1); $('#Inputfield_parentTemplate').val(plural); $('#Inputfield_childTemplate').val(singular); $('#Inputfield_parentPageTitle').val(plural); }); }); Of course the user would want to double-check that the plural/singular forms are what they want, but this addition could save time if you are creating a lot of select fields (which is something I needed to do recently). The pluralize library looks like it handles non-English languages too but I couldn't find documentation on that and I'm not competent to test that myself. What do you think?
-
max file size validation for file/image fields
Robin S replied to chrizz's topic in Wishlist & Roadmap
Exactly the same as the hook I posted above, but substitute InputfieldImage for InputfieldFile. -
Mask page edit URL to custom profile edit page
Robin S replied to gebeer's topic in Module/Plugin Development
I haven't needed to do anything like this before, but I think it might be better to use a separate template for all these extra profile fields. When a user is added you use a hook to automatically create a profile page for the user. Or potentially vice-versa. The user page and the profile page would be connected via a Page Reference field. When it comes to editing the profile pages you may want to let users change their password or email address. This could be done by providing a (modal?) link to ProcessProfile within the Page Edit interface (using Runtime Markup or similar) or you could add password and email address fields to the profile template and then update the equivalent fields in the user page in a saveReady hook. -
Thanks for these updates - working perfectly now.