public function VideoFilter::settingsForm in Video Filter 8
Generates a filter's settings form.
Parameters
array $form: A minimally prepopulated form array.
\Drupal\Core\Form\FormStateInterface $form_state: The state of the (entire) configuration form.
Return value
array The $form array with additional form elements for the settings of this filter. The submitted form values should match $this->settings.
Overrides FilterBase::settingsForm
File
- src/
Plugin/ Filter/ VideoFilter.php, line 293
Class
- VideoFilter
- Render Video Filter.
Namespace
Drupal\video_filter\Plugin\FilterCode
public function settingsForm(array $form, FormStateInterface $form_state) {
$form['width'] = [
'#type' => 'textfield',
'#title' => $this
->t('Player Width'),
'#description' => $this
->t('Default width value'),
'#default_value' => $this->settings['width'],
'#maxlength' => 4,
];
$form['height'] = [
'#type' => 'textfield',
'#title' => $this
->t('Player Height'),
'#description' => $this
->t('Default height value'),
'#default_value' => $this->settings['height'],
'#maxlength' => 4,
];
$form['allow_multiple_sources'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Allow multiple sources'),
'#description' => $this
->t('Allow the use of multiple sources (used source is selected at random).'),
'#default_value' => $this->settings['allow_multiple_sources'],
];
$plugins = [];
foreach ($this->plugin_manager
->getDefinitions() as $plugin_info) {
$plugin = $this->plugin_manager
->createInstance($plugin_info['id']);
$plugins[$plugin_info['id']] = $plugin
->getName();
}
$form['plugins'] = [
'#type' => 'checkboxes',
'#title' => $this
->t('Enabled plugins'),
'#options' => $plugins,
'#default_value' => $this->settings['plugins'],
];
return $form;
}