function PreprocessHooks::mediaLibraryItemWidget

Same name and namespace in other branches
  1. 11.x core/themes/admin/src/Hook/PreprocessHooks.php \Drupal\admin\Hook\PreprocessHooks::mediaLibraryItemWidget()

Implements hook_preprocess_media_library_item__widget().

This targets each media item selected in an entity reference field.

Attributes

#[Hook('preprocess_media_library_item__widget')]

File

core/themes/admin/src/Hook/PreprocessHooks.php, line 877

Class

PreprocessHooks
Provides preprocess implementations.

Namespace

Drupal\admin\Hook

Code

public function mediaLibraryItemWidget(array &$variables) : void {
  $variables['content']['remove_button']['#attributes']['class'][] = 'media-library-item__remove';
  $variables['content']['remove_button']['#attributes']['class'][] = 'icon-link';
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.