Jump to content

Search the Community

Showing results for tags 'page save hook'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL







Found 2 results

  1. Hi i need some help to solve this. I need to save a specific value when saving a page $p = $pages->get('template=customer_project'); $p->location = "Hello world"; $page->save($p); This is my code right now in ready.php. location is my field "text field" inside template "customer_project". Right now when i refresh a page with the template it only populates one page? I want every page that has this field "location" to say Hello world and save it to the database? Don´t know if a hook is better.. PLEASE HELP!!!
  2. Hello, I have a page field type (Multiple pages(PageArray)) with the input field type as AsmSelect. The admin users can select one or more pages from a list in the admin area. Some of those pages have children and if a checkbox is selected and the parent page has been added to the list, then I want to add the child pages as well on page save. So in admin.php I am trying to set those id's, but I can't get them to save. Hopefully the code clears up what I am trying to do. I appreciate any assistance. $pages->addHookAfter('save', function($event) { $pages = $event->object; $page = $event->arguments(0); //check if on template if($page->template == 'item') { //is the checkbox checked to add children if ($page->add_children == 1) { //get the values in the page field type field foreach ($page->page_assignment as $child) { //if selected pages have childen if ($child->numChildren > 0) { //loop through those children foreach ($child->children as $grandchild) { //set values. //$page->set('page_assignment', array($grandchild->id)) $page->page_assignment = array($grandchild->id); //we got the id of the page we need to s $pages->error($grandchild->id); } } } } }
  • Create New...