Jump to content

Page referencefield - custom PHP code not working in repeater


gebeer
 Share

Recommended Posts

Hello,

on a fresh 3.0.62 install I have a page reference field 'mypages' with these settings for selectable pages:

59520a3a3f892_2017-06-27093239.thumb.png.fc7b4fd4029ecb29161e69587a54b494.png

In my site/ready.php I have this hook:

/**
 * custom page select
 */
wire()->addHookAfter('InputfieldPage::getSelectablePages', function($event) {

  if($event->object->name != 'mypages') return;
 
  $pages = new PageArray();
  $pages->add($this->pages->get(1));
  $ids = $pages->explode('id');
  $event->return = $event->pages->getById($ids);

});

On a normal page, the hook is working and the mypages field has only 'Home' in the select dropdown .

But when I put the mypages field inside a repeater, it is not working.

I have this problem on a project that is in development right now and have spent quite some time to try and find the reason. Then I made a fresh PW install to verify the behavior.
No matter if repeater dynamic loading is on or off, the page reference field always returns the  set of pages defined by the settings in the page reference field. The hook is ignored.

Can anyone please verify this and let me know so I can file a bug report. Also if you have an idea how to fix this, I would be happy.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...