Hooks for collections no longer working

Created on 16 March 2023, almost 2 years ago
Updated 31 May 2023, over 1 year ago

We've made collections for content using
hook_content_type_collections & hook_vocabularies_collections

but these are no longer picked up.

🐛 Bug report
Status

Closed: works as designed

Version

2.0

Component

Code

Created by

🇧🇪Belgium svdhout

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

Comments & Activities

  • Issue created by @svdhout
  • Status changed to Closed: works as designed over 1 year ago
  • 🇧🇪Belgium kriboogh

    Version 2 is a rewrite of the hook system. You need to convert your individual hooks into 1 using the plugin ids that come with the module now.

    See admin_toolbar_content.api.php for syntax.

    Available plugins are (found in admin_toolbar_content/src/Plugin/AdminToolbarContent)

    • 'content'
    • 'categories'
    • 'drupal'
    • 'menus'
    • 'media'
    • 'webform'

    Within each 'plugin' the items are now all defined with a 'items' key.

    Example:

    hook_content_type_collections() {
      return [
        'contacts' => [
          'label' => 'Contacts',
          'content-types' => [
            'bin_district',
          ],
        ]
      ];
    }
    
    hook_vocabularies_collections() {
      return [
        'cat_a' => [
          'label' => 'Category A',
          'vocabularies' => [
             'vocabulary_id_a',
             'vocabulary_id_b'
          ]
        ]
      ];
    }
    
    

    Becomes:

    hook_admin_toolbar_content_collections() {
      return [
        'content' => [
          'contacts' => [
            'label' => 'Contacts',
            'items' => [
              'bin_district',
            ],
          ]
        ],
       'categories' => [ 
          'cat_a' => [
            'label' => 'Category A',
            'items' => [
              'vocabulary_id_a',
              'vocabulary_id_b'
            ]
          ]
        ]
      ];
    }
    
    
Production build 0.71.5 2024