You are here

function template_preprocess_filebrowser_container_column in Filebrowser 8.2

Same name and namespace in other branches
  1. 3.x filebrowser.module \template_preprocess_filebrowser_container_column()

Prepares variables for container templates.

Default template: container.html.twig.

Parameters

array $variables: An associative array containing:

  • element: An associative array containing the properties of the element. Properties used: #id, #attributes, #children.

File

./filebrowser.module, line 366

Code

function template_preprocess_filebrowser_container_column(&$variables) {
  $variables['has_parent'] = FALSE;
  $element = $variables['element'];

  // Ensure #attributes is set.
  $element += [
    '#attributes' => [],
  ];

  // Special handling for form elements.
  if (isset($element['#array_parents'])) {

    // Assign an html ID.
    if (!isset($element['#attributes']['id'])) {
      $element['#attributes']['id'] = $element['#id'];
    }
    $variables['has_parent'] = TRUE;
  }
  $variables['children'] = $element['#children'];
  $variables['attributes'] = $element['#attributes'];

  // filebrowser:
  $variables['width'] = $variables['element']['#attributes']['width'];
}