Page header (menu) item - only frontend?
Permalink
In the toolbar in the top, I'm trying to add menu items. Now this is working perfectly when I'm browsing the frontend of the website. The dashboard though, does not seem to have these links added. Is there a flag we can use in the code or some setting or... Is this simply meant to be for frontend only? I'm using the "addPageHeaderMenuItem" function on the "helper/concrete/ui/menu" helper.
This code above does not work of course if you haven't got the controllers and package in place, this is just example code. I have this all working, just not in the dashboard. Trying to find out if this is how this was supposed to be like this and if we can have this in the dashboard too!
Thanks.
$options = array(); $concreteUIMenuHelper = Core::make('helper/concrete/ui/menu'); $concreteUIMenuHelper->addPageHeaderMenuItem('controller_handle', 'package_handle', $options);
This code above does not work of course if you haven't got the controllers and package in place, this is just example code. I have this all working, just not in the dashboard. Trying to find out if this is how this was supposed to be like this and if we can have this in the dashboard too!
Thanks.
But isn't it obvious if you want it on the frontend, you want it on the backend too? They look exactly identical now too. Could be me of course, just want to know why this is and how we can choose to have it on both "sides" without editing view files!
I totally agree. It would make navigating faster and more consistent.
I did a bit of digging ...and it would need a bit of work on the core.
The menu is displayed in concrete/elements/page_controls_footer.php.
Around line 19 the dashboard pages are excluded:
3 things would be needed for this to work nicely:
- adapt page_controls_footer.php - get the MenuItems out of that condition, but maintain structure for position and css
- add extra flags for the MenuItems to show them in editor/dashboard...like the left and right ones.
- add some extra tests on these new flags.
I did a bit of digging ...and it would need a bit of work on the core.
The menu is displayed in concrete/elements/page_controls_footer.php.
Around line 19 the dashboard pages are excluded:
if (isset($cp) && $canViewToolbar && (!$dh->inDashboard())) {
3 things would be needed for this to work nicely:
- adapt page_controls_footer.php - get the MenuItems out of that condition, but maintain structure for position and css
- add extra flags for the MenuItems to show them in editor/dashboard...like the left and right ones.
- add some extra tests on these new flags.
I already figured this one out by adding like 10 lines of code and without changing anything in the default view file. Of course, I copied over this file and moved it over to /application. This way I will be overriding the default view. Sad thing is though, if the core view file changes somewhere, I have to make those changes too. So it's not the best solution. Just trying to find out why this is the behavior... Perhaps they just missed these lines of code!?
The dashboard pages have their own theme:
/concrete/themes/dashboard
Adding some code to elements/header.php would probably solve this. but maybe it's not the best way to do it.