function PreprocessHooks::linksMediaLibraryMenu
Same name and namespace in other branches
- main core/themes/admin/src/Hook/PreprocessHooks.php \Drupal\admin\Hook\PreprocessHooks::linksMediaLibraryMenu()
Implements hook_preprocess_links__media_library_menu().
This targets the menu of available media types in the media library's modal dialog.
@todo Do this in the relevant template once https://www.drupal.org/project/drupal/issues/3088856 is resolved.
Attributes
#[Hook('preprocess_links__media_library_menu')]
File
-
core/
themes/ admin/ src/ Hook/ PreprocessHooks.php, line 843
Class
- PreprocessHooks
- Provides preprocess implementations.
Namespace
Drupal\admin\HookCode
public function linksMediaLibraryMenu(array &$variables) : void {
foreach ($variables['links'] as &$link) {
// Add a class to the Media Library menu items.
$link['attributes']->addClass('media-library-menu__item');
$link['link']['#options']['attributes']['class'][] = 'media-library-menu__link';
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.