public function FileVideoFormatter::settingsForm in Drupal 10
Same name and namespace in other branches
- 8 core/modules/file/src/Plugin/Field/FieldFormatter/FileVideoFormatter.php \Drupal\file\Plugin\Field\FieldFormatter\FileVideoFormatter::settingsForm()
- 9 core/modules/file/src/Plugin/Field/FieldFormatter/FileVideoFormatter.php \Drupal\file\Plugin\Field\FieldFormatter\FileVideoFormatter::settingsForm()
Returns a form to configure settings for the formatter.
Invoked from \Drupal\field_ui\Form\EntityDisplayFormBase to allow administrators to configure the formatter. The field_ui module takes care of handling submitted form values.
Parameters
array $form: The form where the settings form is being included in.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Return value
array The form elements for the formatter settings.
Overrides FileMediaFormatterBase::settingsForm
File
- core/
modules/ file/ src/ Plugin/ Field/ FieldFormatter/ FileVideoFormatter.php, line 42
Class
- FileVideoFormatter
- Plugin implementation of the 'file_video' formatter.
Namespace
Drupal\file\Plugin\Field\FieldFormatterCode
public function settingsForm(array $form, FormStateInterface $form_state) {
return parent::settingsForm($form, $form_state) + [
'muted' => [
'#title' => $this
->t('Muted'),
'#type' => 'checkbox',
'#default_value' => $this
->getSetting('muted'),
],
'width' => [
'#type' => 'number',
'#title' => $this
->t('Width'),
'#default_value' => $this
->getSetting('width'),
'#size' => 5,
'#maxlength' => 5,
'#field_suffix' => $this
->t('pixels'),
'#min' => 0,
'#required' => TRUE,
],
'height' => [
'#type' => 'number',
'#title' => $this
->t('Height'),
'#default_value' => $this
->getSetting('height'),
'#size' => 5,
'#maxlength' => 5,
'#field_suffix' => $this
->t('pixels'),
'#min' => 0,
'#required' => TRUE,
],
];
}