Reputation: 4048
I have page for product editing (product/edit/[:id]). I want to show this page in breadcrumbs, but I don't want it to show in navigation menu.
Here is my code in view:
echo $this->navigation('admin_navigation')->breadcrumbs(); // for breadcrumbs
echo $this->navigation('admin_navigation')->menu(); // for menu
Upvotes: 1
Views: 447
Reputation: 1516
Set the "visible" flag in your "navigation" configuration:
[
'label' => 'Edit',
'controller' => Controller\IndexController::class,
'action' => 'edit',
'visible' => false, // Hidden from menu but will be shown in breadcrumb
],
Change
echo this->navigation('admin_navigation')->breadcrumbs()
to:
echo $his->navigation('admin_navigation')->breadcrumbs()->setRenderInvisible(true)
Upvotes: 1
Reputation: 1274
This solution may not exactly be what you are looking for, but it works.
If you are using some partial template file for the menus or breadcrumbs then you can do the following -
While configuring the navigation in the module.config.php
, add a custom attribute.
Eg: show_in_menu
.
array(
'label' => 'Product List',
'route' => 'product',
'action' => 'edit',
'show_in_menu' => false,
),
Then in the partial file check -
foreach ($this->container as $page) {
if($page->get('show_in_menu') !== false) {
//display the menu
}
}
This way, only the required menus will be displayed.
I hope it helps.
Upvotes: 3