function PreprocessHooks::fileManagedFile

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

Implements hook_preprocess_HOOK() for file_managed_file.

Attributes

#[Hook('preprocess_file_managed_file')]

File

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

Class

PreprocessHooks
Provides preprocess implementations.

Namespace

Drupal\admin\Hook

Code

public function fileManagedFile(array &$variables) : void {
  // Produce the same renderable element structure as image widget has.
  $child_keys = Element::children($variables['element']);
  foreach ($child_keys as $child_key) {
    $variables['data'][$child_key] = $variables['element'][$child_key];
  }
  $this->fileAndImageWidget($variables);
}

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