Skip to content
Snippets Groups Projects

Issue #3515876 by mably: Make this module compatible with Image Crop Widget and others

Open Issue #3515876 by mably: Make this module compatible with Image Crop Widget and others
Open Frank Mably requested to merge issue/svg_image-3515876:3515876-make-this-module into 3.x
Files
2
@@ -50,11 +50,11 @@ class SvgImageWidget extends ImageWidget {
}
/**
* {@inheritdoc}
* Build preview for image widget.
*
* Used by svg_image_field_widget_single_element_form_alter hook.
*/
public static function process($element, FormStateInterface $form_state, $form) {
$element = parent::process($element, $form_state, $form);
public static function processElement($element, FormStateInterface $form_state, $form) {
// Add the image preview.
if (!empty($element['#files']) && $element['#preview_image_style']) {
// Override image preview if SVG file.
@@ -70,10 +70,17 @@ class SvgImageWidget extends ImageWidget {
$element['preview'] = static::buildSvgPreview($file);
}
}
return $element;
}
/**
* {@inheritdoc}
*/
public static function process($element, FormStateInterface $form_state, $form) {
$element = parent::process($element, $form_state, $form);
return static::processElement($element, $form_state, $form);
}
/**
* Builds the SVG file preview.
*
Loading