Add alter hook for links generated by Extra Links deriver

Created on 2 November 2023, over 1 year ago

Problem/Motivation

The links generated by the Extra Links deriver in the admin_toolbar_tools submodule cannot be altered in the UI, and for whatever reason, altering them in hook_preprocess_menu() did not effect any changes in the toolbar when I tried.

Steps to reproduce

Enable the admin_toolbar_tools submodule. It generates a bunch of links, but you can't change them.

Proposed resolution

Add an alter hook for the links generated by the deriver

Remaining tasks

Patch provided

User interface changes

N/A

API changes

New hook, hook_admin_toolbar_extra_links_alter() created

Data model changes

N/A

โœจ Feature request
Status

Active

Version

3.4

Component

Code

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States alieffring

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

Comments & Activities

  • Issue created by @alieffring
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States alieffring

    Adds hook_admin_toolbar_extra_links_alter()

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany ammaletu Bonn, Germany

    I would very much appreciate this addition. The ExtraLinks class unfortunately adds some links which are unncessary and duplicate, and I haven't found a built-in way to remove them.

    It works with the patch #2 and a hook like this:

    /**
    * Implements hook_admin_toolbar_extra_links_alter().
    */
    function mymodule_admin_toolbar_extra_links_alter(&$links): void {
    unset($links['media_library']);
    }

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany ammaletu Bonn, Germany

    I guess for this to be merged we need a test, right?

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia prashant.c Dharamshala

    Prashant.c โ†’ made their first commit to this issueโ€™s fork.

  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia prashant.c Dharamshala

    Thanks @alieffring and @Ammaletu.
    Pushed the code by creating a issue fork, some documentation work is required in admin_toolbar_tools/admin_toolbar_tools.api.php .

  • Status changed to Needs review 17 days ago
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany ammaletu Bonn, Germany

    I corrected the doc block in the api file. There is currently only one test in this module, so I'll be bold here and set this to "needs review". :-)

Production build 0.71.5 2024