Orkun Posted September 9, 2020 Share Posted September 9, 2020 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 More sharing options...
Orkun Posted September 9, 2020 Author Share Posted September 9, 2020 Ok i solved it, by moving the hook into init.php under /site/. 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