public function VideoEmbedWidget::settingsForm in Video 8
Same name and namespace in other branches
- 8.2 src/Plugin/Field/FieldWidget/VideoEmbedWidget.php \Drupal\video\Plugin\Field\FieldWidget\VideoEmbedWidget::settingsForm()
Returns a form to configure settings for the widget.
Invoked from \Drupal\field_ui\Form\EntityDisplayFormBase to allow administrators to configure the widget. 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 definition for the widget settings.
Overrides FileWidget::settingsForm
File
- src/
Plugin/ Field/ FieldWidget/ VideoEmbedWidget.php, line 53
Class
- VideoEmbedWidget
- Plugin implementation of the 'video_embed' widget.
Namespace
Drupal\video\Plugin\Field\FieldWidgetCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$element = [];
$settings = $this
->getSettings();
$provider_manager = \Drupal::service('video.provider_manager');
$element['allowed_providers'] = [
'#title' => t('Video Providers'),
'#type' => 'checkboxes',
'#default_value' => $this
->getSetting('allowed_providers'),
'#options' => $provider_manager
->getProvidersOptionList(),
];
$element['file_directory'] = [
'#type' => 'textfield',
'#title' => t('Thumbnail directory'),
'#default_value' => $settings['file_directory'],
'#description' => t('Optional subdirectory within the upload destination where files will be stored. Do not include preceding or trailing slashes.'),
'#element_validate' => [
[
get_class($this),
'validateDirectory',
],
],
'#weight' => 3,
];
$scheme_options = \Drupal::service('stream_wrapper_manager')
->getNames(StreamWrapperInterface::WRITE_VISIBLE);
$element['uri_scheme'] = [
'#type' => 'radios',
'#title' => t('Thumbnail destination'),
'#options' => $scheme_options,
'#default_value' => $this
->getSetting('uri_scheme'),
'#description' => t('Select where the final files should be stored. Private file storage has significantly more overhead than public files, but allows restricted access to files within this field.'),
'#weight' => 6,
];
return $element;
}