- Issue created by @ckrina
- 🇪🇸Spain ckrina Barcelona
We just discussed this with @Prashant.c and @AkshayAdhav. Since it's feasible to create the links dynamic the way they are right now, I'm changing the issue summary to add this as a requirement so this way there aren't regressions compared with the current one.
- 🇮🇳India prashant.c Dharamshala
Prashant.c → made their first commit to this issue’s fork.
- Merge request !153Initial code to render the Content menu as a block using the Content menu → (Merged) created by prashant.c
- Status changed to Needs work
about 1 year ago 1:56pm 14 December 2023 - 🇮🇳India prashant.c Dharamshala
Took the reference from https://git.drupalcode.org/project/navigation/-/merge_requests/118 created by @deviantintegral.
Trying to integrate the implementation of "Create" menu items using the menu items provided by the newly added menu "Content" through a custom blockNavigationMenuBlock
. - First commit to issue fork.
- Status changed to Needs review
about 1 year ago 8:25pm 15 December 2023 - 🇨🇦Canada m4olivei Grimsby, ON
I've paired back the open MR to only include the creation of the Content menu. I've also added in a link for the Blocks page (/admin/content/block).
I don't see a way for me to mark the MR as ready, so it's still showing as Draft. Maybe @Prashant.c has to do that.
This is ready to review. In summary, it just pulls the relevant code out from @deviantintegral's work in 📌 Convert navigation sections to blocks and use the menu system Active , strictly to create the content menu. To test:
- Open up the Tugboat env and login as admin
- Browse to Structure > Menus
- There should be a "Content" menu added
- Edit the "Content" menu
- The Content menu should have all of the links specified in the description
- Status changed to Needs work
about 1 year ago 8:41pm 15 December 2023 - 🇪🇸Spain ckrina Barcelona
Thanks @m4olivei!
One of the things we change over the last weeks is that we don't want to add the option to add terms there because it easily escalate to more than 6-7 items that would be the usable limit. So I would entirely remove the code that adds the links for taxonomies.
Another thing that differs from the proposed list of links on the issue summary is listing all the Media bundles. Ideally, only Image and Document would be listed there. But that could be moved to a follow-up if it helps close this issue easier!
- Status changed to Needs review
about 1 year ago 1:55am 16 December 2023 - 🇨🇦Canada m4olivei Grimsby, ON
Thanks for the clarification @ckrina. I've made those adjustments. Here's what the Content menu looks like now with Umami:
- Status changed to Needs work
about 1 year ago 5:20am 16 December 2023 - 🇮🇳India prashant.c Dharamshala
@m4olivei Thanks for you efforts.
While testing this i found the following issues:
- Blocks menu link which will open this page
admin/content/block
is present in the "Content" menu in the backend/admin/structure/menu/manage/content
but not appearing on the Navigation sidebar menu. - Not able to edit any menu item, it is throwing error
The website encountered an unexpected error. Try again later. Drupal\Core\Extension\Exception\UnknownExtensionException: The module does not exist. in Drupal\Core\Extension\ExtensionList->get() (line 267 of core/lib/Drupal/Core/Extension/ExtensionList.php). Drupal\Core\Extension\ExtensionList->getName('') (Line: 720) Drupal\Core\Extension\ModuleHandler->getName('') (Line: 99) Drupal\Core\Menu\Form\MenuLinkDefaultForm->buildConfigurationForm(Array, Object) (Line: 74) Drupal\menu_ui\Form\MenuLinkEditForm->buildForm(Array, Object, Object) call_user_func_array(Array, Array) (Line: 536) Drupal\Core\Form\FormBuilder->retrieveForm('menu_link_edit', Object) (Line: 283) Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73) Drupal\Core\Controller\FormController->getContentResult(Object, Object) call_user_func_array(Array, Array) (Line: 123) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 627) Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181) Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76) Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58) Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48) Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106) Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85) Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48) Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51) Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36) Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51) Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704) Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Thanks
- Blocks menu link which will open this page
- 🇮🇳India prashant.c Dharamshala
There are following issues which needs to be adderessed as well.
Changes not reflecting in the frontend after making any changes in the "Content" menu items:- Renaming a menu item
- Enabling/disabling a menu item
- Reordering the menu items
@ckrina whether all these issues needs to be addressed in this issue itself or is this issue is dedicated only to create a menu in the backend which is "Content" menu? Please clarify.
Thanks
- 🇪🇸Spain ckrina Barcelona
It is OK to not place this menu on the left sidebar yet. Since the way to place the menu will depend on how 📌 Convert navigation sections to blocks and use the menu system Active is solved, this can be focused on creating the menu itself only.
About the Blocks 1st level item, I added it on the requirements in purpose. It wasn't implemented on the prototype but we got the feedback that it was confusing since it shows on the Tabs anyway. So for now it needs to go there until we do A/B testing for the final decision.
I've also noticed menu items can't be accessed and edited, and they should.
Thanks both for the work!
- 🇨🇦Canada m4olivei Grimsby, ON
@Prashant.c thanks for the review!
Blocks menu link which will open this page admin/content/block is present in the "Content" menu in the backend /admin/structure/menu/manage/content but not appearing on the Navigation sidebar menu.
As @ckrina pointed out, and @deviantintegral pointed out in 📌 Convert navigation sections to blocks and use the menu system Active , we're using this issue now for the sole purpose of creating the menu we need. It will get put into the sidebar in other issues, probably 📌 Convert navigation sections to blocks and use the menu system Active .
Not able to edit any menu item, it is throwing error
Nice catch. There appears to be a core bug with any menu items that are provided via
hook_menu_links_discovered_alter
. If I install a stock Drupal 10.2.0 instance, then simply edit the "Top search phrases" menu link in the Administration menu (/admin/structure/menu/link/dblog.search/edit), I get the same error. This menu link is provided bydblog_menu_links_discovered_alter
here: https://git.drupalcode.org/project/drupal/-/blob/10.2.0/core/modules/dbl... 😔.Quick search, I'm not seeing an issue for that. Can you confirm you're getting that same error for the "Top search phrases" link out of the box? If that's the case, that's outside our scope here, and we can carry on, maybe file a core bug if we can't find one.
- 🇨🇦Canada m4olivei Grimsby, ON
Ooof, this bug is even present in 9.5.x, so it's been around for awhile at least. Tested using https://simplytest.me/. Here is the instance (not sure how long it will stay up for): https://master-wxnq5cewdtr3b4i3ao2uzpzg79xhaxh6.tugboatqa.com/user (pw is admin/admin).
- Status changed to Needs review
about 1 year ago 2:48pm 18 December 2023 - 🇨🇦Canada m4olivei Grimsby, ON
I found a work-around. Turns out there is an undocumented property (subject of #2729455: list of menu item properties in hook_menu_links_discovered_alter() is incomplete → ) that you need to return from
hook_menu_links_discovered_alter
which isprovider
. I've included that and we no longer get the error.Apologies for the noise in the commit history, I got some work mixed up. The change is good now though.
- 🇮🇳India prashant.c Dharamshala
@m4olivei
Great catch regarding the
provider
, the error is gone but, the menu names are not editable anymore they are all changed to links only.Thanks
- 🇨🇦Canada m4olivei Grimsby, ON
Great catch regarding the provider, the error is gone but, the menu names are not editable anymore they are all changed to links only.
I believe that's expected behavior. It's how any menu item provided via
module_name.links.menu.yml
orhook_menu_links_discovered_alter
behaves. For example all links in the Administrative menu (/admin/structure/menu/manage/admin). As an admin, you can disable any of the links provided and add new links if you like. I imagine we might also get to a point in the future where as an admin you could disable this whole Navigation Section plugin and swap it with something else. That's work for future tickets though. - 🇮🇳India prashant.c Dharamshala
Alright thanks for the clarification then I think this should be good to go.
- 🇨🇦Canada m4olivei Grimsby, ON
@Prashant.c would you mind marking as RTBC if you feel so inclined?
- Status changed to RTBC
about 1 year ago 11:18am 19 December 2023 - 🇪🇸Spain ckrina Barcelona
It looks like this needs a local rebase to manually resolve conflict.
- 🇨🇦Canada m4olivei Grimsby, ON
I've resolved the merge conflict. Should be good to go now.
- Status changed to Fixed
about 1 year ago 2:13pm 19 December 2023 Automatically closed - issue fixed for 2 weeks with no activity.