Robin S

  • Content count

  • Joined

  • Last visited

  • Days Won


Robin S last won the day on July 13

Robin S had the most liked content!

Community Reputation

4,248 Excellent


About Robin S

  • Rank
    Hero Member

Profile Information

  • Gender
  • Location
    New Zealand

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Robin S

    Welcome @torf! Profields Table would be ideal, but Repeater, PageTable and Page Reference (with modal editing via AsmSelect) are also candidates, or even a custom repeating fieldtype in the style of the demo Events module. Oh, and one more: child pages together with Batch Child Editor. And another: pages from anywhere (not just children) with inline editing via Lister Pro. So many options...
  2. Robin S

    Thanks for the new search features @ryan! I wonder if the keyword to bring up the search help should be something less likely to be typed in by a site editor, e.g. "~help". Because it's not that unlikely that an editor might want to find a page with the word "help" in it. To test I created a page titled "Help" and that was not included in the results when I searched "help". The option to include search results from a module sounds interesting but I'm struggling to think of an existing module that might want to give search results other than pages. Maybe @adrian's Admin Actions module? What sorts of modules do you think would use that feature?
  3. Robin S

    It's never overkill to create the fields you need to achieve the functionality you want. For efficiency PW sorts pages when it gets them in the SQL query. So when you get pages from the database whatever you want to sort on must exist as a column in the database. You can sort a PageArray independently of this but it's less efficient and will be problematic when you have a large number of pages or want to add pagination to your results. Also, think about the sorting of names like "Anthony van Diemen" if you were to try to sort without an explicit "last name" field. There is no need to enter anything twice. There are a few different ways you could go about it - here is the one that I prefer because it's simple and intuitive even if it does involve some minor redundancy of data... This assumes you have a template team_members that allows children of template team_member. 1. Install the core PagePathHistory module if you haven't already (a must-have for every site). 2. Install the Page Rename Options module. 3. Add text fields first_name and last_name to template team_member, right after the title field. Make them required fields, and a width of 50% would make sense. 4. In template team_member re-label the title field to "Full name" and set the field visibility to "Open when populated + Closed when blank + Locked (not editable)". 5. In the Family tab of template team_members set "Name format for children" to "Y/m/d H:i:s". This allows new pages added under this template to skip the first step of the "Add New" process. New pages will get a name according to the date/time they were added but this is only temporary until they are published or saved for the first time. 6. Add the following hook to /site/ready.php $pages->addHookAfter('saveReady', function(HookEvent $event) { $page = $event->arguments(0); // Only for the team_member template if($page->template != 'team_member') return; // Skip if this page is brand new and doesn't have any data yet if(!$page->id) return; // Derive the title (Full name) from the first_name and last_name fields // The Page Rename Options module will take care of updating the page name to match $page->title = $page->first_name . ' ' . $page->last_name; }); Now in your template files you can get and sort on the first_name and last_name fields independently. If you want the full name you could output those fields together, but why bother when you also have the full name in the title field. Having the full name in the title field is nice because things in the PW admin (Page List, Page Edit headings, admin search) continue to work without needing any special settings or additional hooks.
  4. Robin S

    These two spring to mind: $user->isLoggedin() $user->isSuperuser()
  5. Robin S

    Working fine here with AdminThemeUikit. Yes, this module adds features to a PageTable field, so you need to have FieldtypePageTable installed and add a PageTable field to your template. In v0.1.1 I have made FieldtypePageTable an install requirement for the module to avoid any confusion about this.
  6. Robin S

    If you have a lot of fields on the page/template in question it would be worth increasing max_input_vars to see if that solves it.
  7. Not sure what you mean here. If you mean the id of "1234" in my demo code that is just to indicate that you need to use a page id on this line and not a Page object or some other page property. You can get that page id any way you like - it doesn't have to be hardcoded.
  8. Robin S

    @OviS, thanks, this was just a case of fixing a conditional to account for a possible value of zero. Should be fixed in v0.1.2.
  9. Robin S

    The subfolder will be created, and you most likely are saving your file to the temp directory. You can check this with file_exists() after the file is saved in your script. But I believe what is happening is that subfolder and temp file are removed by the destruct() method of WireTmpDir during PHP shutdown. If you want the file to persist after the destruction of the WireTmpDir object then it looks like the WireTmpDir::setRemove() method is what you want. $wireTempDir->setRemove(false);
  10. Robin S

    Hi @pout, welcome to the PW forums. If I understand right you have a Page Reference field "user" in your "order" template, and a Page Reference field "orders" in your "user" template. You can use the Connect Page Fields module to link these two Page Reference fields together - see the module readme for more information.
  11. If all you want the edit page to show is a list of children then maybe you would be better off replacing ProcessPageEdit::execute() entirely. E.g. $wire->addHookBefore('ProcessPageEdit::execute', function(HookEvent $event) { /* @var ProcessPageEdit $ppe */ $ppe = $event->object; $page = $ppe->getPage(); if($page->template != 'my-template') return; $event->replace = true; /* @var InputfieldForm $form */ $form = $this->modules->InputfieldForm; /* @var InputfieldMarkup $f */ $f = $this->modules->InputfieldMarkup; $f->name = 'ChildrenPageList'; $f->label = 'Children / Subpages'; if($page->numChildren) { /* @var ProcessPageList $ppl */ $ppl = $this->modules->ProcessPageList; $ppl->id = $page->id; $ppl->showRootPage = false; $f->value = $ppl->execute(); $template_sortfield = $page->template->sortfield; if($template_sortfield && $template_sortfield != 'sort') { $f->notes = sprintf('Children are sorted by "%s", per the template setting.', $template_sortfield); } } else { $f->description = 'There are currently no children/subpages below this page.'; } $form->add($f); $event->return = $form->render(); }); If you wanted the "Add New Page Here" button and "Sort Settings" fieldset too then you could add those by borrowing from the code in ProcessPageEdit::buildFormChildren().
  12. Try this in /site/ready.php: $wire->addHookAfter('InputfieldCKEditor::renderReadyHook', function(HookEvent $event) { $inputfield = $event->object; $page = $inputfield->hasPage; $field = $inputfield->hasField; // Whatever test you need to identify when the asset page should be changed if($field->name === 'body' && $page->template == 'basic_page') { $js_config = $this->config->js('InputfieldCKEditor_' . $inputfield->name); $js_config['pwAssetPageID'] = 1234; // The id of the asset page you want to use $this->config->js('InputfieldCKEditor_' . $inputfield->name, $js_config); } }); Seems to work well in the PW admin, but the code comment here suggests it won't work for front-end editing.
  13. Robin S

    Not sure sorry, but it's working for me.
  14. Robin S

    Looks really nice! Just wondering about the approach you've taken - if this module is about styling changes to the core AdminThemeUikit couldn't the module just add a CSS file containing the style overrides and not reproduce all the AdminThemeUikit files?
  15. But what I'm saying is that Profiler has a dedicated pro support board where you can get optimisation advice from Ryan, the creator of ProcessWire. Nobody knows more about optimising PW than him.