3 namespace Drupal\bootstrap\Plugin\Preprocess;
5 use Drupal\bootstrap\Utility\Element;
6 use Drupal\bootstrap\Utility\Variables;
9 * Pre-processes variables for the "image_widget" theme hook.
11 * @ingroup plugins_preprocess
13 * @see image-widget.html.twig
15 * @BootstrapPreprocess("image_widget",
16 * replace = "template_preprocess_image_widget"
19 class ImageWidget extends PreprocessBase implements PreprocessInterface {
24 public function preprocessElement(Element $element, Variables $variables) {
25 $variables->addClass([
27 'js-form-managed-file',
32 $data = &$variables->offsetGet('data', []);
33 foreach ($element->children() as $key => $child) {
34 $data[$key] = $child->getArray();