Issue #3425318 by Wim Leers, smustgrave: Update `type: field.formatter.settings.file_video` to match the validation logic in FileVideoFormatter's settings form

(cherry picked from commit 6e7fa7f365)
merge-requests/6829/merge
Dave Long 2024-03-11 17:17:57 +00:00
parent a69343b5b5
commit 106d55288c
No known key found for this signature in database
GPG Key ID: ED52AE211E142771
2 changed files with 24 additions and 2 deletions

View File

@ -95,6 +95,8 @@ field.field_settings.file:
file.formatter.media:
type: mapping
label: 'Media display format settings'
constraints:
FullyValidatable: ~
mapping:
controls:
type: boolean
@ -105,9 +107,17 @@ file.formatter.media:
loop:
type: boolean
label: 'Loop'
# @see \Drupal\file\Plugin\Field\FieldFormatter\FileMediaFormatterBase::settingsForm
multiple_file_display_type:
type: string
label: 'Display of multiple files'
constraints:
# @see \Drupal\file\Plugin\Field\FieldFormatter\FileMediaFormatterBase::settingsSummary()
Choice:
# Multiple file display: Multiple HTML tags
- tags
# Multiple file display: One HTML tag with multiple sources
- sources
field.formatter.settings.file_audio:
type: file.formatter.media
@ -116,6 +126,8 @@ field.formatter.settings.file_audio:
field.formatter.settings.file_video:
type: file.formatter.media
label: 'Video file display format settings'
constraints:
FullyValidatable: ~
mapping:
muted:
type: boolean
@ -123,9 +135,17 @@ field.formatter.settings.file_video:
width:
type: integer
label: 'Width'
nullable: true
constraints:
Range:
min: 1
height:
type: integer
label: 'Height'
nullable: true
constraints:
Range:
min: 1
field.formatter.settings.file_default:
type: mapping

View File

@ -54,7 +54,8 @@ class FileVideoFormatter extends FileMediaFormatterBase {
'#size' => 5,
'#maxlength' => 5,
'#field_suffix' => $this->t('pixels'),
'#min' => 0,
// A width of zero pixels would make this video invisible.
'#min' => 1,
],
'height' => [
'#type' => 'number',
@ -63,7 +64,8 @@ class FileVideoFormatter extends FileMediaFormatterBase {
'#size' => 5,
'#maxlength' => 5,
'#field_suffix' => $this->t('pixels'),
'#min' => 0,
// A height of zero pixels would make this video invisible.
'#min' => 1,
],
];
}