Jump to content

Limit PageTable Items displayed in Admin


Orkun
 Share

Recommended Posts

I have a pagetable field called "partner_create_events" where partners should be able to create new Events.
Now at the moment there are already Events from last year. I tried to hide these Event Pages inside the admin table view with a hook.

But somehow when you add a new pagetable item it doesn't execute the hook and I don't know why.
I tought it would work, since InputfieldPageTableAjax.php is calling the render() Method inside renderAjax(). Can you help please?

My code is inside ready.php under /site/.

$wire->addHookBefore("InputfieldPageTable::render", function(HookEvent $event) {
    $obj = $event->object;
    if($obj->name == 'partner_create_events') {
        $pagearray = $obj->value;
        $newpagearray = wire('pages')->find("id=$pagearray, select_year.id=2");
        $obj->value = $newpagearray;
    }
});


KR
Orkun

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...