Jump to content

selector pagereference in field


webhoes
 Share

Recommended Posts

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?

image.thumb.png.3da8f535bf136a26e7d10e8765aa5c8d.png

Link to comment
Share on other sites

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

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");
    }
});
  • Like 1
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...