webhoes Posted June 22, 2018 Share Posted June 22, 2018 Hello, I have the following selector on a pagereference field. It returns no output (an echo of the same selector returns output). If I replace $suser with 41 it does work. I also tried to do this via ready.php. Also no output. What is wrong? Link to comment Share on other sites More sharing options...
Soma Posted June 22, 2018 Share Posted June 22, 2018 You can't use API vars in the selector. You'd have to use the Custom PHP code to build the selectable pages. Link to comment Share on other sites More sharing options...
webhoes Posted June 22, 2018 Author Share Posted June 22, 2018 thanks @Soma. I also tried that with several version like this. No error but also no output. Namespace Processwire is added at the top of ready.php so I assumed $user would be useable here... $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->hasField == 'turtles_fed') { $event->return = $event->pages->find('template=turtle, created_users_id={$user}'); } }); Link to comment Share on other sites More sharing options...
webhoes Posted June 22, 2018 Author Share Posted June 22, 2018 Got it... with a lot of trail and error. $this->user. $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->hasField == 'turtles_fed') { $event->return = $event->pages->find("template=turtle, created_users_id=$this->user"); } }); 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now