Jump to content

Robin S

Members
  • Posts

    4,791
  • Joined

  • Days Won

    303

Everything posted by Robin S

  1. 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.
  2. @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
  3. 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!
  4. In executeFoo() you would check the URL segments and do different things accordingly. In executeFoo() $input->urlSegment1 is "foo".
  5. 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.
  6. Not exactly the same scenario but an example of combining repeater items from different sources into a PageArray:
  7. 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.
  8. 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).
  9. Maybe some CSS conflict. If that's not it then I'm out of ideas, sorry.
  10. 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)
  11. Are there any JS errors in the browser console? I just tested it with embed option C and it's working for me here.
  12. 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).
  13. A new addon action module for Admin Actions created to meet this need:
  14. Replace Home An action for the Admin Actions module for ProcessWire CMS/CMF. The action replaces the template and content of the home page with that of a selected page. Sometimes there is a need to develop a new home page while keeping the existing home page in place until the new version is ready and approved. Then you want to apply the new home page, but this is not so easy to do in ProcessWire since home is a special page that cannot simply be replaced by another page. What the action does Removes all the fields from the home template, which simultaneously deletes all the content from the home page. Adds all the fields from the selected source page template and applies any template-specific overrides. Sets the home page field values to match the source page. Updates all file and image URLs in any textareas so they point to the home page files rather than the original source page. What the action doesn't do The action does not modify the home template file. You will probably want to update the home template file immediately after running the action (e.g. copy/paste the code of the source page template file). The action does not automatically delete the source page – that can be done manually after you have confirmed that the action was successfull. Warning This action is destructive! It deletes content/files/images from the existing home page. In addition to the automatic Admin Actions database backup you should create a backup of /site/assets/files/ before running this action, and consider also making a manual database backup for extra safety. Usage Install the Replace Home module. Visit the Admin Actions config screen and enable the "Replace Home" action for the roles who are allowed to use it. Create file system and database backups – see the warning section above. Navigate to Admin Actions > Replace Home, select the source page whose template and content will replace the home page, then execute the action. Update the home template file if needed. Screenshot https://github.com/Toutouwai/AdminActionsReplaceHome https://processwire.com/modules/admin-actions-replace-home/
  15. PW doesn't support that kind of sorting in $pages->find(), but you could use the FindMerge module and do something like this: $base_selector = "title=foo"; $selectors = [ "$base_selector, template=template1", "$base_selector, template=template2|template3", "$base_selector, template!=template1|template2|template3", ]; $pagination_limit = 20; $results = $pages->findMerge($selectors, $pagination_limit);
  16. Probably it applies to the strikethrough to any non-core fieldtypes because it can't guarantee 100% compatibility. Did you try ticking the checkbox anyway? It seems to work when I did some quick testing.
  17. The forum search supports specific syntaxes depending on how you want multiple words searched, and there are expandable search options too. It explains some of the options after you do a search. That's an unrelated search feature. The forum is powered by IP.Board and the blog posts are powered by ProcessWire.
  18. Cool tip, thanks! As an aside, are you using findRaw() to get your data for the options? My experience lately is that when I make use of findRaw() I rarely need to cache this sort of thing because it's so much faster than loading whole Page objects.
  19. There is a $config setting that lets you specify roles that are not allowed to log in. /** * Names (string) or IDs (int) of roles that are not allowed to login * * Note that you must create these roles yourself in the admin. When a user has * one of these named roles, $session->login() will not accept a login from them. * This affects the admin login form and any other login forms that use ProcessWire’s * session system. * * The default value specifies a role name of "login-disabled", meaning if you create * a role with that name, and assign it to a user, that user will no longer be able * to login. * * @var array * */ $config->loginDisabledRoles = array( 'login-disabled' ); So in /site/config.php you could temporarily have something like: $config->loginDisabledRoles = ['your-role-name'];
  20. You'll want to sanitize search input before using it in a selector string. 🙂 And here's an alternative way you could search across the FAQ items: $search = $sanitizer->selectorValue($input->get('search')); $faqs = new PageArray(); foreach($page->faqs_groups as $group) { $faqs->add($group->faqs); } $results = $faqs->find("title|body*=$search");
  21. @BrendonKoz, you can use the hook below to target the children() selector used in PageListSelect/PageListSelectMultiple and remove the "status" clause that allows unpublished and hidden pages. Because those inputfields use ProcessPageList the tricky part is only affecting the inputfields and not the main page tree. After some digging I found that you can distinguish these cases by a "labelName" GET variable. $wire->addHookBefore('ProcessPageList::find', function(HookEvent $event) { $selector = $event->arguments(0); $name = $event->wire()->input->get('labelName'); if($name === 'your_page_reference_field_name') { $selector = str_replace(', status<9999999', '', $selector); $event->arguments(0, $selector); } }); Before: After:
  22. Hi @adrian, The "Delete Unused Templates" action is throwing an error for me in recent PW versions: Maybe related to this change mentioned in the 3.0.210 release blog post? Update: adding an if($fieldgroup) test to the action seems to resolve it... if($fieldgroup) $this->wire('fieldgroups')->delete($fieldgroup);
  23. I created a GitHub issue: https://github.com/processwire/processwire-issues/issues/1669
  24. Your selector string will be "id=page.name_of_your_repeater_field, check_access=0". The "check_access=0" is so that it works for non-superusers. In the example below I'm using a repeater field named "test_repeater". If you repeater doesn't include the title field you'll want to choose something different in the "Label field" setting.
×
×
  • Create New...