public function BynderVideoFormatter::settingsForm in Bynder 4.0.x
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 FormatterBase::settingsForm
File
- src/
Plugin/ Field/ FieldFormatter/ BynderVideoFormatter.php, line 40
Class
- BynderVideoFormatter
- Plugin implementation of the 'Bynder Video' formatter.
Namespace
Drupal\bynder\Plugin\Field\FieldFormatterCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$elements = parent::settingsForm($form, $form_state);
$elements['controls'] = [
'#title' => $this
->t('Show playback controls'),
'#type' => 'checkbox',
'#default_value' => $this
->getSetting('controls'),
];
$elements['autoplay'] = [
'#title' => $this
->t('Autoplay'),
'#type' => 'checkbox',
'#default_value' => $this
->getSetting('autoplay'),
];
$elements['loop'] = [
'#title' => $this
->t('Loop'),
'#type' => 'checkbox',
'#default_value' => $this
->getSetting('loop'),
];
$elements['muted'] = [
'#title' => $this
->t('Muted'),
'#type' => 'checkbox',
'#default_value' => $this
->getSetting('muted'),
];
$elements['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,
];
$elements['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,
];
return $elements;
}