-
Posts
5,039 -
Joined
-
Days Won
340
Everything posted by Robin S
-
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.
-
image descriptions can't be changed in my repeaters
Robin S replied to rushy's topic in General Support
I haven't heard of such an issue before. My only other idea is to make sure $config->debug = true in /site/config.php so that you will see any PHP errors that might be occurring. Or better yet, install Tracy Debugger and enable the debug bar for the backend as this will catch errors even more reliably. -
This worked for me: Alternatively this also worked, in /site/modules/InputfieldCKEditor/config.js: CKEDITOR.editorConfig = function( config ) { config.colorButton_colors = 'CF5D4E,454545,FFF,CCC,DDD,CCEAEE,66AB16'; };
-
CKE pwlink: pages without templates shouldn't be selectable
Robin S replied to Klenkes's topic in General Support
These are already excluded from the autocomplete as far as I can tell. // ProcessPageEditLink > Link to URL: exclude pages using templates without template file and unpublished pages $wire->addHookBefore('InputfieldPageAutocomplete(name=link_page_url)::render', function(HookEvent $event) { $inputfield = $event->object; $fileless_templates = []; foreach($this->wire()->templates as $template) { if(!$template->filenameExists()) $fileless_templates[] = $template->id; } $inputfield->findPagesSelector .= ', status!=unpublished, template!=' . implode('|', $fileless_templates); }); // ProcessPageEditLink > Select Page / Select Child Page: prevent selection of pages using templates without template file and unpublished pages $wire->addHookAfter('ProcessPageEditLink::execute', function(HookEvent $event) { $css = '.PageListStatusUnpublished .PageListActionSelect, '; foreach($this->wire()->templates as $template) { if(!$template->filenameExists()) $css .= ".PageListTemplate_{$template->name} .PageListActionSelect, "; } $css = rtrim($css, ', '); $css .= ' { display:none !important; }'; $event->return .= "<style>$css</style>"; }); -
The current version of the module isn't creating any option pages when using the standard "title only" option for Select Options. The parent page is created but no child pages. Settings: Result:
-
Hi Adrian, I think it would be good to provide a dedicated field for setting the parent page title rather than setting it the same as the field title. An example: I'm creating a select field to choose a geographical region. Only one region may be selected, so the field title should be "Region". Each individual page represents a region and together they make up the set of regions, so it makes sense to me that the parent of those pages should be titled "Regions" and not "Region".
-
Mixed content error in admin of secure site
Robin S replied to AAD Web Team's topic in General Support
I can't reproduce that on my secure sites - for me the panel and modal load pages over HTTPS. Normally for an HTTPS-only site you would enable the HTTPS redirection in .htaccess: https://github.com/processwire/processwire/blob/341342dc5b1c58012ae7cb26cffe2c57cd915552/htaccess.txt#L91-L95 So that would be something to check. -
CKE pwlink: pages without templates shouldn't be selectable
Robin S replied to Klenkes's topic in General Support
My guess is that some non-printable character got pasted inside your code. See the comments in this thread from here down: If that's not it then you can also use Tracy Debugger to debug why $template is undefined for you. All that the relevant code inside the hook is doing is looping over the $templates API variable with $template representing each Template object, so I can't see where else that could be going wrong. -
image descriptions can't be changed in my repeaters
Robin S replied to rushy's topic in General Support
Do you have a large number of inputs on this page? Inputs being images, repeater items, other fields. If so you might be exceeding PHP's max_input_vars setting. https://www.virendrachandak.com/techtalk/big-forms-and-php-max_input_vars/ If you do have a lot of inputs and cannot change max_input_vars then it may help if your repeater items are ajax-loaded as needed and not opened by default. -
Minimal Fieldset Adds a config option to Fieldset/FieldsetGroup/FieldsetPage to render the fieldset without label or padding in Page Edit. When a neighbouring field in the same row is taller than the fieldset the extra height is distributed evenly among rows within the fieldset. Requires ProcessWire v3 and AdminThemeUikit. Why? This module allows you to create layouts in Page Edit that would not be possible without it. It's useful when you want a layout that has two or more fields as rows that are themselves within a row in Page Edit. It's also useful when you have some fields that you want to add to a template as a group (i.e. via FieldsetGroup or FieldsetPage) but having a heading and visible wrapper for the fieldset in Page Edit would be redundant. Example: Installation Install the Minimal Fieldset module. Usage In the field settings for any Fieldset/FieldsetGroup/FieldsetPage, tick the "Remove label and padding for this fieldset" checkbox. https://github.com/Toutouwai/MinimalFieldset https://modules.processwire.com/modules/minimal-fieldset/
- 19 replies
-
- 26
-
-
-
CKE pwlink: pages without templates shouldn't be selectable
Robin S replied to Klenkes's topic in General Support
There are different inputfields in ProcessPageEditLink and they need to be treated differently: Link to URL, Select Page, Select Child Page. For Link to URL I agree that there is probably no common use case that needs pages without template files to be visible/selectable here. For Select Page and Select Child Page, I think that pages without template files should appear there because those pages may have viewable child pages, and also I think it is easier for users to understand these inputfields if they show the same pages that they are familiar with from ProcessPageList where non-viewable pages are listed. But the pages without template files should not be selectable as links. I suggest you raise a GitHub request or issue to ask for a change to this. In the meantime here are a couple of workaround hooks for /site/ready.php: // ProcessPageEditLink > Link to URL: exclude pages using templates without template file $wire->addHookBefore('InputfieldPageAutocomplete(name=link_page_url)::render', function(HookEvent $event) { $inputfield = $event->object; $fileless_templates = []; foreach($this->wire()->templates as $template) { if(!$template->filenameExists()) $fileless_templates[] = $template->id; } $inputfield->findPagesSelector .= ', template!=' . implode('|', $fileless_templates); }); // ProcessPageEditLink > Select Page / Select Child Page: prevent selection of pages using templates without template file $wire->addHookAfter('ProcessPageEditLink::execute', function(HookEvent $event) { $css = ''; foreach($this->wire()->templates as $template) { if(!$template->filenameExists()) $css .= ".PageListTemplate_{$template->name} .PageListActionSelect, "; } if($css) { $css = rtrim($css, ', '); $css .= ' { display:none !important; }'; $event->return .= "<style>$css</style>"; } }); -
Yep, works well here. New PR made.
-
How to copy template fields to a new template and keep it updated?
Robin S replied to LAPS's topic in General Support
user_copy should be a new template without any fields already added to it. The only field it should contain is the automatic Title field which is not a permanent field unless you manually changed it to be permanent. -
How to copy template fields to a new template and keep it updated?
Robin S replied to LAPS's topic in General Support
Instead of doing this, try the following instead: 1. In /site/config.php set $config->advanced = true; 2. Create your user_copy template (whatever you want to call it) 3. On the "Basics" tab of Edit Template, select "user" for "Fieldgroup" and save. 4. Remove the line you added in step 1. Now the user_copy template will always have the same fields as the user template. -
Done. Not sure, but I wonder if it's related to the PHP notices from Adminer & plugins I mentioned earlier in our PM conversation. Maybe with debug mode on the error reporting level changes and those notices are being output somewhere before session start.
-
Wonderful write-up, and a very elegant and precise website. Thanks and congratulations! Very much OT, but I was interested to see that one of your clients is the Osho UTA Institute. I saw a fascinating Netflix doco recently about the history of the Osho (aka Bhagwan Shree Rajneesh) movement in the USA: https://en.wikipedia.org/wiki/Wild_Wild_Country
-
I think I might have found the source of this issue. It seems to relate to debug mode in /site/config.php. When debug mode is on I get the session warning and when it is off I don't. Can you confirm @kongondo? @adrian, this fix isn't working reliably for me. If I visit the "MySQL" root item in the breadcrumbs, then browse into a database table, then click the database name in the breadcrumbs I get a 404. I wonder if the simplest thing might be to reverse your previous fix and make a small modification to adminer-4.6.3-mysql.php: on line 531 change "&db=" to "?db=". Seems to work well here for both the Process module and the panel. BTW, the adminer-4.6.3-mysql.php file is pretty horrible. I get why the project owner wants to compile everything into one file but it results in some weird encoding (PhpStorm gives encoding warnings when the file is opened and is liable to auto-save the file and mess it up in the process) and it's very difficult to debug. Do you think it would be feasible at all to do a custom compilation of the source to make it a bit more readable and leave out the lzw compression?
-
You can set variables to $config for this purpose, e.g.
-
No worries. Big thanks for adding Adminer to Tracy and enjoy your time away.
-
Personally I'd rather open Adminer in a new tab and have the whole screen dedicated to it. Is there a way you could make it configurable whether to have the PW menu or not? Or perhaps there could just be a small link back to the PW admin root?
-
I think it would be good to add this - I'd use it. Either option would be okay, but my preference would be to see Adminer in the Setup menu.