adrianmak Posted December 29, 2016 Posted December 29, 2016 I setup a page template which has a pageTable field. To display the child page (on front-end) of the PageTable field in the parent page, user should edit the parent page and add child page within here. However, I found that many users are likely use the "New" button from the parent's context menu. As a result, users always ask me why their child pages could not show on the front-end. What can I do to avoid user to add child pages from the parent's context menu ? Hide the “New" button ?
BitPoet Posted December 29, 2016 Posted December 29, 2016 Yes. A simple way would be hooking into ProcessPageListActions::getActions in your site/ready.php: wire()->addHookAfter("ProcessPageListActions::getActions", null, "removeNewAction"); function removeNewAction(HookEvent $event) { $page = $event->arguments(0); if($page->template == "blog") { $actions = $event->return; unset($actions['new']); $event->return = $actions; } } 3
adrian Posted December 29, 2016 Posted December 29, 2016 Or you could have new child pages automatically added to the page table field: Be sure to read the comment two posts lower which mentions a bug and a fix. 2
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