Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/29/2023 in all areas

  1. You can actually adapt that to a selector string that will allow you to use Page Autocomplete: In a Page Reference field selector string, "page" is a special keyword that PW converts into "the page that is open in Page Edit". This isn't documented anywhere as far as I know, but it would be good if it was @ryan.
    3 points
  2. Sorry, my explanation wasn't sufficient. My icons are there since I added them by myself. So thank you for the instruction but I wanted to say in my previous message, that they disappeared suddenly. And this I discovered later that it was caused by a module. After I removed the module all pages returned with their assigned icons. Just for inform you guys I found the cause and now the task is completed. Thank you.
    1 point
  3. This week updates continued with various .js files in the core (for jQuery 3.6+ compatibility). A few external libraries were also updated to the latest versions, including jquery-tablesorter, jquery-ui-timepicker, magnific-popup and vex. And finally, InpufieldTinyMCE has been added to the core! That's a lot of updates, but there's not a lot more to write about these updates because we covered the jQuery updates last week, and InputfieldTinyMCE has been the topic of several past posts. But now we've got everything together and running smoothly in ProcessWire 3.0.216. I think we're now ready to focus on getting the next main/master version out in the coming weeks. There likely won't be an update next week because I'll be traveling for a few days, but will be back to a regular schedule the following week. Thanks for reading and have a great weekend!
    1 point
  4. You'll need to write this line as... } else if($dl->ext() == "doc" or $dl->ext() == "docx") { ...or else it will always evaluate as true regardless of the extension. A good candidate for rewriting as a switch statement too.
    1 point
  5. Now solved. For the benefit of others, you need to set the sort property of the repeater rather than use a custom property. i.e. for each repeater page: $subPage->sort = $j; // where $j is the required sort index $subPage->save(); then after all 'subPages' have been set: $page->$repeaterName->sort('sort'); and save the page.
    1 point
  6. It is neither built-in nor is it a field - it is just a custom property that you are setting to a page object while it is in memory. You can name the property anything you like - it doesn't need to be named "custom_sort". The "custom_sort" is not saved to the database for any page - it only exists while the page is in memory, and it's purpose is simply to provide some property to use the sort() method on. Then once the PageArray is sorted on that property and saved to the Page Reference field the sort is retained as part of the Page Reference field value. If you just give it a go it will probably start to make more sense.
    1 point
  7. What is causing you to draw this conclusion? The value of a (multiple) Page Reference field is a PageArray. The sort order of pages in the field will be the sort order of the pages in the PageArray at the time the field (or the whole page containing the field) is saved. So setting the sort order of the field consists of putting the pages in the PageArray into the order you want and then saving the field (or the whole page containing the field). So if I have a Page Reference field "colours" which is currently empty on page $p and I add some pages to the field then the order is the order in which I add them (to the PageArray)... $p->of(false); $yellow = $pages->get('name=yellow'); $p->colours->add($yellow); $red = $pages->get('name=red'); $p->colours->add($red); $blue = $pages->get('name=blue'); $p->colours->add($blue); $p->save('colours'); // Alternatively you could save the whole page // Sort order of $p->colours is yellow, red, blue Suppose I now want to change this sort order to some other custom order. Let's say I want to sort them by the length of the page name. $p->of(false); foreach($p->colours as $colour) { $colour->custom_sort = strlen($colour->name); } $p->colours->sort('custom_sort'); $p->save('colours'); // Alternatively you could save the whole page // Sort order of $p->colours is red, blue, yellow
    1 point
  8. If you are searching for programatically save your own programatical defined sort order, you may find useful code snippets here: Interesting for you are the function(calls) of databaseUpdateSortInPages Also reading the few discussion posts may be of interest.
    1 point
  9. A search to hide "delete" tab brought me here. Thanks soma for the code. In order to hide the tab(s), you have to add another hook to edit form: $this->addHook('ProcessPageEdit::getTabs', $this, 'hookEditFormTabs'); public function hookEditFormTabs($event) { // logic check // if ($this->user->isSuperuser()) return; // if ($this->page->id != 29) return; $tabs = $event->return; unset($tabs['ProcessPageEditDelete']); $event->return = $tabs; }
    1 point
×
×
  • Create New...