public function ImageWidget::preprocessElement in Express 8
Preprocess the variables array if an element is present.
Parameters
\Drupal\bootstrap\Utility\Element $element: The Element object.
\Drupal\bootstrap\Utility\Variables $variables: The Variables object.
Overrides PreprocessBase::preprocessElement
File
- themes/
contrib/ bootstrap/ src/ Plugin/ Preprocess/ ImageWidget.php, line 29 - Contains \Drupal\bootstrap\Plugin\Preprocess\ImageWidget.
Class
- ImageWidget
- Pre-processes variables for the "image_widget" theme hook.
Namespace
Drupal\bootstrap\Plugin\PreprocessCode
public function preprocessElement(Element $element, Variables $variables) {
$variables
->addClass([
'image-widget',
'js-form-managed-file',
'form-managed-file',
'clearfix',
]);
$data =& $variables
->offsetGet('data', []);
foreach ($element
->children() as $key => $child) {
$data[$key] = $child
->getArray();
}
}