Problem/Motivation

The top level admin sections result in a disjointed experience for people with primarily content creation/management focused permissions. Access to items that for these users are similar tools is spread out across multiple admin sections.

From #3203618: New “content creation” menu proposal.

All the Usability tests we've run so far confirmed the usefulness of #3203618: New “content creation” menu proposal. This issue is to create this "menu", independently of how #3397058: Convert navigation sections to blocks and use the menu system evolves.

Proposed resolution

Right now the content shown in the existing Navigation comes from web/modules/navigation/src/Plugin/Navigation/NavigationContent.php.

For the first iteration of this menu let's replace the hard-coded menu with an MVP functionality as a regular menu. To not have a regression with the current code, the elements below the "Create" item should be dynamic based on the content types the site has and list all of them.
Future iterations of this will probably include a simpler way to customize this menu for Site builders than the menu UI. For now, the items under the Create section will be able to be customized through the Menu UI.

Menu name: Content management.

The menu structure will be:

  • Create
    • Article (based on the Content types available*)
    • Basic Page (based on the Content types available*)
    • Image (If Media is enabled)
    • Document (If Media is enabled)
    • User
  • Content
  • Blocks
  • Files
  • Media (If Media is enabled)

Remaining tasks

User interface changes

API changes

Data model changes

Issue fork navigation-3408298

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

ckrina created an issue. See original summary.

ckrina’s picture

Issue summary: View changes

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.

Prashant.c made their first commit to this issue’s fork.

prashant.c’s picture

Status: Active » Needs work
Related issues: +#3397058: Convert navigation sections to blocks and use the menu system
prashant.c’s picture

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 block NavigationMenuBlock.

m4olivei made their first commit to this issue’s fork.

m4olivei’s picture

Status: Needs work » Needs review

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 #3397058: Convert navigation sections to blocks and use the menu system, 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
ckrina’s picture

Status: Needs review » Needs work

Thanks @m4olivei!

One of the things we changed over the last weeks (since Andrew worked on his initial MR in the other issue) 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!

m4olivei’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new141.65 KB

Thanks for the clarification @ckrina. I've made those adjustments. Here's what the Content menu looks like now with Umami:

prashant.c’s picture

Status: Needs review » Needs work
StatusFileSize
new80.59 KB

@m4olivei Thanks for you efforts.

While testing this i found the following issues:

  1. 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.
  2. Missing Blocks link

  3. Not able to edit any menu item, it is throwing error
  4. 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

prashant.c’s picture

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:

  1. Renaming a menu item
  2. Enabling/disabling a menu item
  3. 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

ckrina’s picture

It is OK to not place this menu on the left sidebar yet. Since the way to place the menu will depend on how #3397058: Convert navigation sections to blocks and use the menu system 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!

m4olivei’s picture

@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 #3397058: Convert navigation sections to blocks and use the menu system, 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 #3397058: Convert navigation sections to blocks and use the menu system.

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 by dblog_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.

m4olivei’s picture

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).

m4olivei’s picture

Status: Needs work » Needs review

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 is provider. 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.

prashant.c’s picture

@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.

Edit menu names are Links

Thanks

prashant.c’s picture

StatusFileSize
new126.84 KB
m4olivei’s picture

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 or hook_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 in the navigation sidebar and swap it with something else. That's work for future tickets though.

prashant.c’s picture

Alright thanks for the clarification then I think this should be good to go.

m4olivei’s picture

@Prashant.c would you mind marking as RTBC if you feel so inclined?

prashant.c’s picture

Status: Needs review » Reviewed & tested by the community

Looks good to me.

ckrina’s picture

It looks like this needs a local rebase to manually resolve conflict.

m4olivei’s picture

I've resolved the merge conflict. Should be good to go now.

ckrina’s picture

Status: Reviewed & tested by the community » Fixed

Yass!! Thank you both for pushing this forward!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.