Allow other modules to include their own Navigation blocks during installation

Created on 2 December 2024, 20 days ago

Problem/Motivation

Navigation module provides a flexible system to manage the blocks shown in the Navigation Bar. However, it can be confusing for site admins that they have to manually add the Navigation blocks provided by other modules, or even they won't notice that other modules are providing those blocks.

The aim of this issue id to provide a simple system that will allow modules to add Navigation Blocks in a similar way as recipes do in Provide Config Action to add new blocks to navigation from recipes Active . In this way, block are added to the Navigation Bar, and editors afterwards can decide whether the blocks can be moved or removed from the bar.

Dashboard and it's Dashboard block is a good example for this new feature.

Proposed resolution

Create a new hook navigation_deafults that allows to define Navigation blocks that will be added to Navigation when the module providing the logic in installed.

Remaining tasks

Finish definition
Test POC

User interface changes

None

Introduced terminology

None

API changes

Add a new hook defined in Navigation module to declare the default blocks.

Data model changes

Release notes snippet

Feature request
Status

Active

Version

11.0 🔥

Component

navigation.module

Created by

🇪🇸Spain plopesc Valladolid

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

Merge Requests

Comments & Activities

  • Issue created by @plopesc
  • Pipeline finished with Success
    20 days ago
    Total: 559s
    #356567
  • 🇪🇸Spain plopesc Valladolid
  • 🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺

    This would be super useful for a bunch of modules. Not having this logic in navigation means having to duplicate it elsewhere (dashboard that I'm aware, potentially workspaces, environment indicator, etc).

    Added some comments, but nothing should be blocking. New feature has test coverage.

    Hope this can make it to 11.1.

  • Pipeline finished with Success
    18 days ago
    Total: 772s
    #358678
  • 🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺

    LGTM then.

    Wondering if there should be an issue for adding the 'plugin.manager.config_action' service to core.services.yml to allow autowiring or if this was intentional.

    This is not strictly speaking a Drupal CMS blocker as there are workarounds, but definitely is a nice to have.

  • Pipeline finished with Failed
    18 days ago
    Total: 167s
    #359030
  • Pipeline finished with Success
    18 days ago
    Total: 3240s
    #359051
  • 🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺

    Neat!

  • 🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺

    Just remembered about $is_syncing. We don't want duplicated blocks.

  • 🇪🇸Spain plopesc Valladolid

    I did not realize until you mentioned it. Great catch!

    Changes added to the MR.

  • Pipeline finished with Success
    17 days ago
    Total: 495s
    #360127
  • 🇪🇸Spain penyaskito Seville 💃, Spain 🇪🇸, UTC+2 🇪🇺

    Back to RTBC

Production build 0.71.5 2024