Hide empty menu items and update config settings

Created on 21 March 2024, 9 months ago
Updated 19 April 2024, 8 months ago

Problem/Motivation

When a collection is empty (due to access permissions on it's child menu items), the collection is still visible.
When recent items list is empty, the "recent content" item is still visible.
Allow recent items to link to a node view instead of the edit form.
Schema is hardcoded for default plugins, this needs to become dynamic so third party plugins can also define their settings.

Proposed resolution

Add config options to hide empty collections, empty recent items list.
Add extra option in the recent item link settings to link to a entity view (canonical url).
And update hook will convert existing configuration.
Redefine the settings schema using dynamic config types.

Data model changes

The admin_toolbar_content.settings structure will change, by putting plugin specific settings under the 'plugins' key.

common:
  group_collections: ''
  hide_empty_collections: 0
plugins:
  content:
    enabled: true
    recent_items:
      number_of_items: 10
      hide_empty_list: 0
      link: default
    hide_non_content_items: true
    hide_content_type_items:
      content_view: '0'
      admin_permissions: '0'
  categories:
    enabled: true
  media:
    enabled: true
    link_media_library: true
  webform:
    enabled: true
  menus:
    enabled: true
  drupal:
    enabled: true
    account_links: both

Defining plugin settings can be done by extending from the base config schema type admin_toolbar_content.plugin.[%key]:

admin_toolbar_content.plugin:
  type: mapping
  mapping:
    enabled:
      type: boolean
      label: 'Enable'

Example:

admin_toolbar_content.plugin.media:
  type: admin_toolbar_content.plugin
  mapping:
    link_media_library:
      type: boolean
      label: 'Link to media library' 
✨ Feature request
Status

Fixed

Version

2.0

Component

User interface

Created by

🇧🇪Belgium kriboogh

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024