Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
svg_image
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
svg_image
Merge requests
!49
Issue
#3515876
by mably: Make this module compatible with Image Crop Widget and others
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Issue
#3515876
by mably: Make this module compatible with Image Crop Widget and others
issue/svg_image-3515876:3515876-make-this-module
into
3.x
Overview
0
Commits
1
Pipelines
5
Changes
2
Open
Frank Mably
requested to merge
issue/svg_image-3515876:3515876-make-this-module
into
3.x
1 month ago
Overview
0
Commits
1
Pipelines
5
Changes
2
Expand
Closes
#3515876
0
0
Merge request reports
Compare
3.x
version 4
e913a1cc
1 month ago
version 3
2702a792
1 month ago
version 2
b01bb5c6
1 month ago
version 1
859943c7
1 month ago
3.x (HEAD)
and
latest version
latest version
39bd5ac8
1 commit,
1 month ago
version 4
e913a1cc
1 commit,
1 month ago
version 3
2702a792
1 commit,
1 month ago
version 2
b01bb5c6
1 commit,
1 month ago
version 1
859943c7
1 commit,
1 month ago
2 files
+
53
−
5
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
src/Plugin/Field/FieldWidget/SvgImageWidget.php
+
12
−
5
Options
@@ -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