You are here

function template_preprocess_dropzonejs in DropzoneJS 8

Same name and namespace in other branches
  1. 8.2 dropzonejs.module \template_preprocess_dropzonejs()

Prepares variables for dropzone form element.

Default template: dropzonejs.html.twig.

Parameters

array $variables: An associative array containing:

  • element: A render element representing the file.

File

./dropzonejs.module, line 45
Contains dropzonejs.module.

Code

function template_preprocess_dropzonejs(array &$variables) {
  $element = $variables['element'];
  $variables['attributes'] = [];
  if (isset($element['#id'])) {
    $variables['attributes']['id'] = $element['#id'];
  }
  if (!empty($element['#attributes']['class'])) {
    $variables['attributes']['class'] = (array) $element['#attributes']['class'];
  }
  $variables['dropzone_description'] = $element['#dropzone_description'];
  $variables['or_text'] = t('or');
  $variables['select_files_button_text'] = t('Select files');
  $variables['uploaded_files'] = $element['uploaded_files'];
}