public function InsertView::settingsForm in Advanced Insert View 8
Same name in this branch
- 8 src/Plugin/Filter/InsertView.php \Drupal\insert_view_adv\Plugin\Filter\InsertView::settingsForm()
- 8 src/Plugin/CKEditorPlugin/InsertView.php \Drupal\insert_view_adv\Plugin\CKEditorPlugin\InsertView::settingsForm()
Same name and namespace in other branches
- 2.0.x src/Plugin/CKEditorPlugin/InsertView.php \Drupal\insert_view_adv\Plugin\CKEditorPlugin\InsertView::settingsForm()
Returns a settings form to configure this CKEditor plugin.
If the plugin's behavior depends on extensive options and/or external data, then the implementing module can choose to provide a separate, global configuration page rather than per-text-editor settings. In that case, this form should provide a link to the separate settings page.
Parameters
array $form: An empty form array to be populated with a configuration form, if any.
\Drupal\Core\Form\FormStateInterface $form_state: The state of the entire filter administration form.
\Drupal\editor\Entity\Editor $editor: A configured text editor object.
Return value
array A render array for the settings form.
Overrides CKEditorPluginConfigurableInterface::settingsForm
File
- src/
Plugin/ CKEditorPlugin/ InsertView.php, line 56
Class
- InsertView
- The plugin for insert_view_adv .
Namespace
Drupal\insert_view_adv\Plugin\CKEditorPluginCode
public function settingsForm(array $form, FormStateInterface $form_state, Editor $editor) {
$settings = $editor
->getSettings();
if (!empty($settings['plugins']['insert_view_adv'])) {
$plugin_specific_settings = $settings['plugins']['insert_view_adv'];
}
else {
$plugin_specific_settings = [
'enable_live_preview' => TRUE,
];
}
$form['enable_live_preview'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Enable live preview of the view token'),
'#description' => $this
->t('By default CKEditor displays only token with view details, if you want to see the exact results of the view leave this checkbox checked'),
'#default_value' => isset($plugin_specific_settings['enable_live_preview']) ? $plugin_specific_settings['enable_live_preview'] : TRUE,
'#return_value' => TRUE,
];
return $form;
}