Closed (fixed)
Project:
Svg Image
Version:
3.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
28 Jun 2022 at 18:14 UTC
Updated:
13 Nov 2023 at 05:44 UTC
Jump to comment: Most recent, Most recent file
When saving a view mode through the UI, if width/height settings for a formatter are left empty, the width/height are saved as null.
But when just running the image_post_update_image_loading_attribute() core update hook, they are saved as empty string.
This is due to this:
/**
* {@inheritdoc}
*/
public static function defaultSettings() {
return [
'svg_attributes' => ['width' => '', 'height' => ''], 'svg_render_as_image' => TRUE,
] + parent::defaultSettings();
}
Replace with null and it will behave more consistently I think.
/**
* {@inheritdoc}
*/
public static function defaultSettings() {
return [
'svg_attributes' => ['width' => null, 'height' => null], 'svg_render_as_image' => TRUE,
] + parent::defaultSettings();
}
We should also set 'nullable: true' in the schema for these fields.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3293185-3.patch | 1.4 KB | daniel korte |
| #2 | 3293185-2.patch | 1.43 KB | daniel korte |
Comments
Comment #2
daniel korteComment #3
daniel kortePrevious patch is for 2.x and this one is for 3.x
Comment #4
imyaro commentedComment #6
imyaro commentedThanks for that patch, applied