-
Posts
5,013 -
Joined
-
Days Won
335
Everything posted by Robin S
-
You can view the path history when the page is open in Page Edit, on the Settings tab: And from the API:
-
It seems to be working here. If the code is going to be executed when the user is other than a superuser then you would need check_access=0 in the selector because the admin template is restricted.
- 1 reply
-
- 1
-
-
FYI, there is an option in the AdminThemeUikit module config for sticky header and page tree visible in the sidebar.
- 46 replies
-
I don't know what the field structure is in your template. It should work fine as described in my previous post. Inputfield names doesn't have much to do with it - you use field names just as you would in any selector. If the selector matches your page in $pages->find($selector) then it should work in the "Show only if page is matched by selector" setting. Seeing screenshots of your template fields and the settings you have chosen for CustomInputfieldDependencies would help. That isn't related to this module. It comes from the core show-if and required-if features, so if you are seeing that in your markup it means you are not using the features added by CustomInputfieldDependencies. See the screenshot below.
-
For those who just want to let users upload WEBP format and are looking for a workaround, here is a simple module that converts WEBP to JPG on upload: I wonder though... how is it that the user acquired the WEBP image in the first place? Surely they didn't just pinch it off somebody else's website... ?
-
WebP to JPG Converts WebP images to JPG format on upload. This allows the converted image to be used in ProcessWire image fields, seeing as WebP is not supported as a source image format. Config You can set the quality (0 – 100) to be used for the JPG conversion in the module config. Usage You must set your image fields to allow the webp file extension, otherwise the upload of WebP images will be blocked before this module has a chance to convert the images to JPG format. https://github.com/Toutouwai/WebpToJpg https://processwire.com/modules/webp-to-jpg/
-
Did you try something already and it didn't work? You should be able to use either the "Show only if page is matched by selector"... your_matrix_field.count>0 ...or the "Show only if custom PHP returns true" setting... $items = $page->getFormatted('your_matrix_field'); if($items && $items->count) return true; If you were wanting to do the opposite, i.e. show the field only when the matrix field is empty, then it should work to put "your_matrix_field.count=0" into the "Show only if page is matched by selector" setting but unfortunately there seems to be a core PW bug: https://github.com/processwire/processwire-issues/issues/1701 So until that's fixed you'd need to use the "Show only if custom PHP returns true" setting instead: $items = $page->getFormatted('your_matrix_field'); if($items && !$items->count) return true;
-
According to the docs, uppercase letters are not valid for URL segments: https://processwire.com/docs/admin/setup/templates/#allow-url-segments
- 6 replies
-
- urlsegments
- url issue
-
(and 1 more)
Tagged with:
-
@adrian, thanks for looking into this request but after some more investigation I don't think there will be a good way for PageRenameOptions to deal with the ProcessPageClone issue. It's something that would need to be addressed within ProcessPageClone. It works out the copy number - (copy 2), (copy 3), etc - by looking at the page name to check for an existing number suffix. So it needs to name the first clone with a "1" suffix and yet it wants to title that first clone without the "1". If we change PageRenameOptions to set the clone name from the title then there's no number suffix on the first clone and so it messes up the calculation for subsequent clones. I don't think there will be changes to ProcessPageClone any time soon, and in fact the whole problem would largely be avoided if my request from 2018 was actioned. So instead I'm going to solve this with a couple of extra hooks: // Make ProcessPageClone always use "Copy Page" form // https://github.com/processwire/processwire-requests/issues/186 $wire->addHookAfter('ProcessPageListActions::getExtraActions', function(HookEvent $event) { $page = $event->arguments(0); $actions = $event->return; if(empty($actions['copy'])) return; $config = $event->wire()->config; $actions['copy']['url'] = "{$config->urls->admin}page/clone/?id={$page->id}"; $event->return = $actions; }, ['priority' => 200]); // Set "Copy Page" name field to match title field $wire->addHookAfter('ProcessPageClone::buildForm', function(HookEvent $event) { /** @var InputfieldForm $form */ $form = $event->return; $title_field = $form->getChildByName('clone_page_title'); $name_field = $form->getChildByName('clone_page_name'); if($title_field && $name_field) { $name_field->value = $event->wire()->sanitizer->pageName($title_field->value, Sanitizer::translate); } }); With these hooks PageRenameOptions will do its normal thing and sync the name field as I type a new title in the ProcessPageClone "Copy Page" form.
-
To further complicate things, it seems that PageRenameOptions might be interfering with the normal clone titles. When the module isn't installed the (copy 2), (copy 3), etc is what I would expect... ...but when PageRenameOptions is installed I get duplicates like this (edit: to be clear, this is the result after 6 clones)... If the duplicate thing didn't happen then maybe the page names would always match the title without anything else needed? (assuming the hook you suggested) Edit: here are my PageRenameOptions settings: {"PageRenameOptions":{"version":"2.0.1","settings":{"enableForApi":1,"renameMatchTitle":1,"renameWithoutTitleChange":"","renameUnpublishedOnly":"","includeExclude":"exclude","initialDifference":1,"preventManualChanges":1,"liveChanges":null,"uninstall":"","submit_save_module":"Submit","exemptRolesInitialDifferencesProtected":[],"exemptRolesPreventManualChanges":["superuser"],"exemptRolesLiveChangesProtected":["superuser"],"specifiedPages":[],"specifiedTemplates":[],"initialDifferencesProtected":1,"liveChangesProtected":null}}}
-
That would be good for the English default, but the (copy) part is translatable so it would be difficult to get it working for translations.
-
@ryan, really great updates this week, thanks! WireSitemapXML sounds amazing. I saw this part in the docs: That would be a nice enhancement! Personally I would go for faster performance over greater convenience in hook arguments, but maybe there could be a config option so users could choose which they want to prioritize. Perhaps the page properties that are raw loaded and supplied to the hook methods can also be configurable so users can set what they need to distinguish pages in the hooks. A feature request: sometimes I want to get a plain list of all the URLs in the sitemap - for instance, to load into Xenu's Link Sleuth (I often use this as a simple way to prime ProCache). Maybe there could be a GET variable for that, e.g. /sitemap.xml?urls=1
- 1 reply
-
- 1
-
-
Yes, it works great, thanks. If you clone a page more than once then after the first clone the later ones will still count as "initial differences" because each clone gets a title in the format "Original page name (copy)" but the cloned pages can't all have a name that matches this title under the same parent. And changing the automatic titles of the cloned pages is perhaps going too far, so I think the hook you suggested is sufficient for the basic case. Thanks again!
-
In executeFoo() you would check the URL segments and do different things accordingly. In executeFoo() $input->urlSegment1 is "foo".
-
Working with images in a Files field
Robin S replied to Jonathan Lahijani's topic in General Support
This post maybe? -
I suggest replacing your Select Options field with a Page Reference field. The template for the page items would contain an integer field. My experience is that when deciding between a Select Options field and Page Reference field, the page field is the one you want 90% of the time because pages are so much more powerful and flexible than select options. Even if the needs are simple to begin with, a page field is more future-proof. The Page Field Select Creator module makes the field setup a breeze.
-
It sounds like maybe you have included the scripts twice, or somehow DOMContentLoaded is firing twice, which is strange. But in any case it won't hurt for the module to check if the inputfield is already initialised so I've added that in v0.1.1.
- 21 replies
-
- 1
-
-
Not sure if this the overall cause of your issue, but one problem I can see in your test module code is that parent::___install() can't work because there is no ___install() method in the parent class (WireData).
-
Maybe some CSS conflict. If that's not it then I'm out of ideas, sorry.
- 21 replies
-
Check that you have all the necessary FormBuilder embed code in your template file: You should see this in your rendered page markup (for Basic framework)
- 21 replies
-
Are there any JS errors in the browser console? I just tested it with embed option C and it's working for me here.
- 21 replies
-
Hi @adrian, My standard settings when using this module are "Automatically rename the name field to match the title" and "Initial differences protected" and this generally works great for me - the title and page name are always kept in sync except when I have deliberately changed the name to something that I don't want automatically changed. But one case that has been catching me out is when a page is cloned using the core ProcessPageClone module. When this is done the clone gets a title in the format "Original page name (copy)" but the page name gets the format "original-page-name-1". So from that point on the page gets treated as a case of "initial differences protected" and therefore the name doesn't get updated when the title is changed. Do you think it would be a worthwhile addition to Page Rename Options to try and detect this scenario somehow so that it doesn't count as a case of "initial differences protected"? I'm not sure what the best way to do this would be, but one approach would be to hook after ProcessPageClone has executed and set the page name from the title (e.g. "original-page-name-copy") so that it doesn't count as an initial difference. Update: one more thing... I reckon it would be cool if the module added a button to the name inputfield in the Settings tab which when clicked would sync the name to the current title (via JS I guess).
-
A new addon action module for Admin Actions created to meet this need: