Jump to content

Search the Community

Showing results for tags 'page changed'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. Hello, To compare repeater items when someone added or removed items to/from the repeater, I use this hook wire()->addHookAfter('Pages::saveReady', function($event) { $page = $event->arguments[0]; if($page->isChanged('repeater')) { //get page before changes : https://processwire.com/talk/topic/9734-determine-old-vs-new-value-of-field-when-saving/?do=findComment&comment=106166 $oldPage = $this->wire('pages')->getById($page->id, array( 'cache' => false, // don't let it write to cache 'getFromCache' => false, // don't let it read from cache 'getOne' => true, // return a Page instead of a PageArray )); bardump("new count: {$page->repeater->count}"); bardump("old count: {$oldPage->repeater->count}"); } }); When I add a repeater item, both counts are identical. But they shouldn't. When I remove a repeater item, the counts come out correct. I verified this behavior on a blank PW 3.0.62 install. So I think it is a bug. Can someone please check if they find the same behavior? Thank you. I also tried it with this hook wire()->addHookAfter('Page(template=basic-page)::changed(repeater)', function($event) { // old value bardump($event->arguments[1]->count); // new value bardump($event->arguments[2]->count); }); Same outcome. For the second hook to fire, you need to adjust line 1005 in wire/core/Wire.php to read if(($hooks && $hooks->isHooked('changed()')) || !$hooks) { because of this bug.
×
×
  • Create New...