Create the Content menu

Created on 12 December 2023, 7 months ago
Updated 2 January 2024, 6 months ago

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 🌱 New “content creation” menu proposal Needs review .

All the Usability tests we've run so far confirmed the usefulness of 🌱 New “content creation” menu proposal Needs review . This issue is to create this "menu", independently of how 📌 Convert navigation sections to blocks and use the menu system Active 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

📌 Task
Status

Fixed

Version

1.0

Component

Code

Created by

🇪🇸Spain ckrina Barcelona

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

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

  • Status changed to Needs work 6 months ago
  • 🇮🇳India Prashant.c Dharamshala
  • 🇮🇳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 block NavigationMenuBlock.

  • First commit to issue fork.
  • Status changed to Needs review 6 months ago
  • 🇨🇦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 6 months ago
  • 🇪🇸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 6 months ago
  • 🇨🇦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 6 months ago
  • 🇮🇳India Prashant.c Dharamshala

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

  • 🇮🇳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:

    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

  • 🇪🇸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 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.

  • 🇨🇦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 6 months ago
  • 🇨🇦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 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.

  • 🇮🇳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

  • 🇮🇳India Prashant.c Dharamshala
  • 🇨🇦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 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 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 6 months ago
  • 🇮🇳India Prashant.c Dharamshala

    Looks good to me.

  • 🇪🇸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 6 months ago
  • 🇪🇸Spain ckrina Barcelona

    Yass!! Thank you both for pushing this forward!

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

  • Pipeline finished with Failed
    4 months ago
    Total: 1328s
    #108068
  • Pipeline finished with Failed
    4 months ago
    Total: 1103s
    #108232
  • Pipeline finished with Failed
    4 months ago
    Total: 1013s
    #108833
  • Pipeline finished with Success
    4 months ago
    Total: 1201s
    #108865
  • Pipeline finished with Success
    4 months ago
    Total: 1189s
    #108903
  • Pipeline finished with Success
    2 months ago
    #146486
  • Pipeline finished with Success
    2 months ago
    Total: 167s
    #146487
  • Pipeline finished with Success
    25 days ago
    #187495
  • Pipeline finished with Skipped
    25 days ago
    #187521
Production build 0.69.0 2024