0

I've added the patch to composer.json like this:

  "drupal/admin_toolbar_tools": {
    "Bring back media to dropdown menu": "https://www.drupal.org/files/issues/2019-01-16/admin_toolbar-media_link-3026216-3-option2-D8.patch"
  }

However, admin_toolbar_tools is a sub-module of admin_toolbar (admin_toolbar/admin_toolbar_tools).

I ran composer install, but it doesn't trigger the patch apply process.

The patch I am trying to apply is the following one (https://www.drupal.org/files/issues/2019-01-26/admin_toolbar-media-link-3026216-8-option3.patch).

diff --git a/admin_toolbar_tools/admin_toolbar_tools.module b/admin_toolbar_tools/admin_toolbar_tools.module
index 9ac389c..1f8a36b 100644
--- a/admin_toolbar_tools/admin_toolbar_tools.module
+++ b/admin_toolbar_tools/admin_toolbar_tools.module
@@ -621,20 +621,23 @@ function admin_toolbar_tools_menu_links_discovered_alter(&$links) {

   // If module Media enabled.
   if ($moduleHandler->moduleExists('media')) {
-    $links['admin_toolbar_tools.add_media'] = [
-      'title' => t('Add media'),
-      'provider' => 'admin_toolbar_tools',
-      'route_name' => 'entity.media.add_page',
-      'menu_name' => 'admin',
-      'parent' => 'system.admin_content',
-    ];
+    // Displays media link in toolbar.
+    if (in_array('entity.media.collection', $routes)) {
+      $links['admin_toolbar_tools.media_add_page'] = [
+        'title' => t('Add media'),
+        'provider' => 'admin_toolbar_tools',
+        'route_name' => 'entity.media.add_page',
+        'menu_name' => 'admin',
+        'parent' => 'system.admin_content',
+      ];
+    }
     // Add node links for each media type.
     foreach ($entityTypeManager->getStorage('media_type')->loadMultiple() as $type) {
       $links['media.add.' . $type->id()] = [
         'title' => t($type->label()),
         'provider' => 'admin_toolbar_tools',
         'route_name' => 'entity.media.add_form',
-        'parent' => 'admin_toolbar_tools.add_media',
+        'parent' => 'admin_toolbar_tools.media_add_page',
         'route_parameters' => ['media_type' => $type->id()],
       ];
     }
  • Did you try just it’s parent namespace admin_toolbar? – Kevin May 30 at 10:32
  • Yes I did try that, but it's not working. I'll try again. thanks @Kevin – fkaufusi May 30 at 21:37
1

Use admin_toolbar.

"drupal/admin_toolbar": {
  "Bring back media to dropdown menu": "https://www.drupal.org/files/issues/2019-01-16/admin_toolbar-media_link-3026216-3-option2-D8.patch"
}

Then run composer update or composer update --lock if you want to apply your new patch and do not want to update any packages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.