function MediaLibraryThemeHooks::preprocessMediaLibraryItem

Prepares variables for a selected media item.

Default template: media-library-item.html.twig.

Parameters

array $variables: An associative array containing:

  • element: An associative array containing the properties and children of the element.

File

core/modules/media_library/src/Hook/MediaLibraryThemeHooks.php, line 59

Class

MediaLibraryThemeHooks
Hook implementations for media_library.

Namespace

Drupal\media_library\Hook

Code

public function preprocessMediaLibraryItem(array &$variables) : void {
  $element =& $variables['element'];
  foreach (Element::children($element) as $key) {
    $variables['content'][$key] = $element[$key];
  }
}

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