Open Da-Fecto opened 9 years ago
I didn't recognise that for theme Reno there's an other class and an other method for this. So next to the AdminThemeDefaultHelpers::renderTopNavItems it would be great to have AdminThemeRenoHelpers::renderSideNavItems also hookable. Something like:
public function ___renderSideNavItems($exclude_pages = array()) { ... }
No problem making things hookable, but seems like this is a permissions need rather than a markup one. Wouldn't it be better to hook Page::viewable? Perhaps something like this in your /site/templates/admin.php file:
if(!$user->isSuperuser()) wire()->addHookAfter('Page::viewable', function($event) {
if($event->object->id == 3) $event->return = false; // 3 is id of /processwire/page/
}
I thought of that and have tried it but didn't work out because of the check_access=0 in the selector I guess. (or some other things I don't be aware of)
On the otherhand there are more things in the masthead that I don't wish for this project such as the view button. (Project doesn't need to have a front-end)
+1 for making this method hookable, so we can also add new entries. Also it would be nice if the RenoAdminTheme could use the same method for rendering the main menu items, so that hooks persist when changing admin themes. Not sure how easy this would be... maybe let AdminThemeRenoHelpers
extend AdminThemeDefaultHelpers
and then hook after AdminThemeDefault::renderTopNavItems()
, which then probably should be renamed to something like renderNavItems()
:)
It was stupidity on my side about the permission, your solution works. On the other hand I still have the need to change the markup anyway so the question is still open.
And +1 for what wanze suggests about the naming convention.
It would be great if they were hookable. Currently I need to use additional JavaScript to put my custom items in their place wich is not the prettiest thing.
HI Ryan, can you make AdminThemeDefaultHelpers::renderTopNavItems hookable? I have a need to hide the "Pages" page from the TopNavItems when not logged in as superuser. Or maybe even better:
So a before hook has the opportunity to modify the arguments so pages can be excluded. Thanks !