November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi Daniel
I believe menu items are only for the top and left menu. You can render your tab menu in the main area on your own.
And as long as the action URLs begin with the same URL as the menu item, the menu item should be shown as selected.
Hi Stefan
Thanks for the reply.
Your second statement helped, i.e. 'And as long as the action URLs begin with the same URL as the menu item, the menu item should be shown as selected.'
I had bee using the path '/example/index/' in my UrlMenuItem, the 'index' node was preventing my other actions from matching. I have changed the routing to remove the need to pass the 'index', so it's now just '/example/' and it works... mostly.
With that updated, I still need to 'hack' the Html.CreatePlatformNavigationMenu() to get it to display the menu on the sub-routes (as mentioned earlier)... but now, at least it is showing the admin menu when I visit one of the 'sub-routes', whereas before it was just showing the root cms menu. My only problem now is that the 'active' state on the menu item is only there when I am on the top-level route/url.
So for the most part, this is working, but if anyone knows a better way to do this without the 'hack' or how I can further hack it to show the current menu item as active/selected when on a sub-route, please let me know.
I am working on a custom admin tool which uses mutliple controllers and views.
I have created a Menu Provider class which sucessfully displays the top-level item in the Settings sidebar. Clicking it displays the entry point route as configured in the provider. However, I have other routes within the the admin tool that I want to use too. When I navigate to one of these other routes, I want to keep the sidebar navigation visible with my menu item displayed as active.
This code for the privider:
Here's what it looks like when I select it from the menu:
My goal is that when clicking 'Two', I would be taken to the new route but mainting the 'Example' option active in the sidebar. However, the sidebar does not load, it looks like so...
Here's the controller with a MenuItem attribute on the index Action
Am I doing anything wrong with the declaration of the MenuItems? I have followed the docs here - https://docs.developers.optimizely.com/content-management-system/docs/adding-and-configuring-menu-items - but did not have any luck.
Note, there is a comment on this blog post about the new menu system which is similar to my issue - https://world.optimizely.com/blogs/matthew-slim/dates/2023/6/new-menu-system-released/
Erik's workaround here was to 'hack' the Html.CreatePlatformNavigationMenu() like so:
This almost works, it shows 'a navigation'. However, for me, this just shows the root cms navigation sidebar, it does not show the admin sidebar with my menu item as active.
Does anyone have any experience with this?
Thanks in advance