-
Mark Halliwell authored
Issue #2825131 by markcarver, claudiu.cristea: Run project through coder and fix notices and warnings Signed-off-by:
Mark Carver <mark.carver@me.com>
Mark Halliwell authoredIssue #2825131 by markcarver, claudiu.cristea: Run project through coder and fix notices and warnings Signed-off-by:
Mark Carver <mark.carver@me.com>
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
ImageWidget.php 842 B
<?php
namespace Drupal\bootstrap\Plugin\Preprocess;
use Drupal\bootstrap\Utility\Element;
use Drupal\bootstrap\Utility\Variables;
/**
* Pre-processes variables for the "image_widget" theme hook.
*
* @ingroup plugins_preprocess
*
* @see image-widget.html.twig
*
* @BootstrapPreprocess("image_widget",
* replace = "template_preprocess_image_widget"
* )
*/
class ImageWidget extends PreprocessBase implements PreprocessInterface {
/**
* {@inheritdoc}
*/
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();
}
}
}