Admin Toolbar skip defer fails with Drupal 9.3

Created on 16 February 2022, over 2 years ago
Updated 18 October 2023, 8 months ago

Problem/Motivation

Dropdown of Admin Toolbar fails because the admin_toolbar.js is deferred due deprecated code in Drupal 9.3.

Steps to reproduce

Drupal 9.3 with Admin Toolbar module.
The dropdown menu is not available.
The problem is in this file:
advagg/advagg_mod/src/Asset/DeferJs.php

    // Admin Toolbar 8x fails when deferred.
    if ($this->moduleHandler->moduleExists('admin_toolbar')) {
      $this->skipList[] = Crypt::hashBase64(drupal_get_path('module', 'admin_toolbar') . '/js/admin_toolbar.js' . $this->counter);
    }
  }

View: bootstrap.inc/function/drupal_get_path/9.3.x

Deprecated
in drupal:9.3.0 and is removed from drupal:10.0.0. Use \Drupal\Core\Extension\ExtensionPathResolver::getPath() instead.

Proposed resolution

    // Admin Toolbar 8x fails when deferred.
    if ($this->moduleHandler->moduleExists('admin_toolbar')) {
-      $this->skipList[] = Crypt::hashBase64(drupal_get_path('module', 'admin_toolbar') . '/js/admin_toolbar.js' . $this->counter);
+     $this->skipList[] = Crypt::hashBase64(\Drupal\Core\Extension\ExtensionPathResolver::getPath('module', 'admin_toolbar') . '/js/admin_toolbar.js' . $this->counter);
    }
  }
πŸ› Bug report
Status

Active

Version

4.0

Component

Modifier

Created by

πŸ‡΅πŸ‡ͺPeru cesarllika Cusco

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • First commit to issue fork.
Production build 0.69.0 2024