cb2004 Posted January 21, 2016 Share Posted January 21, 2016 I have a repeater, which with the use of a hook I can stop that from displaying from certain pages: <?php $wire->addHookAfter("ProcessPageEdit::buildForm", function(HookEvent $event) { $process = $event->object; $form = $event->return; $page = $process->getPage(); if ($page->template->id == 44 && $page->parent->id != 1020 && $page->parent->id != 1021) { $form->remove($form->getChildByName("repeater_partners")); } }); My repeater is in a fieldset tab, so on any pages where the repeater should not be displayed, the fieldset tab is (the repeater is not). Any way to remove this within the above? Cheers. Link to comment Share on other sites More sharing options...
LostKobrakai Posted January 21, 2016 Share Posted January 21, 2016 Tabs are cached while building the form, so you're renoving the inputfield, but not the tab for it. There's a function to remove the tab as well in ProcessPageEdit. I'm on mobile, so please look for it on your own. Link to comment Share on other sites More sharing options...
cb2004 Posted January 21, 2016 Author Share Posted January 21, 2016 Should anybody need this: $pages->addHookAfter("ProcessPageEdit::buildForm", function(HookEvent $event) { $page = $event->object->getPage(); $form = $event->return; if ($page->template->id == 44 && $page->parent->id != 1020) { $fieldset = $form->find("id=Inputfield_fieldset_tab_2")->first(); $form->remove($fieldset); $event->object->removeTab("Inputfield_fieldset_tab_2"); } }); Just replace the $page->template->id with the id of your template, and the $page->parent->id to what you want (or something similar). Finally replace fieldset_tab_2 with the name of your field. 5 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