public function Colorbox::settingsForm in Video Embed Field 8.2
Same name and namespace in other branches
- 8 src/Plugin/Field/FieldFormatter/Colorbox.php \Drupal\video_embed_field\Plugin\Field\FieldFormatter\Colorbox::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 FormatterBase::settingsForm
File
- src/
Plugin/ Field/ FieldFormatter/ Colorbox.php, line 158
Class
- Colorbox
- Plugin implementation of the thumbnail field formatter.
Namespace
Drupal\video_embed_field\Plugin\Field\FieldFormatterCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$element = parent::settingsForm($form, $form_state);
$element += $this->thumbnailFormatter
->settingsForm([], $form_state);
$element += $this->videoFormatter
->settingsForm([], $form_state);
$element['modal_max_width'] = [
'#title' => $this
->t('Maximum Width'),
'#type' => 'number',
'#description' => $this
->t('The maximum size of the video opened in the Colorbox window in pixels. For smaller screen sizes, the video will scale.'),
'#required' => TRUE,
'#field_suffix' => 'px',
'#size' => 20,
'#states' => [
'visible' => [
[
':input[name*="responsive"]' => [
'checked' => TRUE,
],
],
],
],
'#default_value' => $this
->getSetting('modal_max_width'),
];
return $element;
}