public function CKEditor::settingsFormSubmit in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/ckeditor/src/Plugin/Editor/CKEditor.php \Drupal\ckeditor\Plugin\Editor\CKEditor::settingsFormSubmit()
Modifies any values in the form state to prepare them for saving.
Values in $form_state->getValue(array('editor', 'settings')) are saved by Editor module in editor_form_filter_admin_format_submit().
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides EditorBase::settingsFormSubmit
File
- core/
modules/ ckeditor/ src/ Plugin/ Editor/ CKEditor.php, line 242 - Contains \Drupal\ckeditor\Plugin\Editor\CKEditor.
Class
- CKEditor
- Defines a CKEditor-based text editor for Drupal.
Namespace
Drupal\ckeditor\Plugin\EditorCode
public function settingsFormSubmit(array $form, FormStateInterface $form_state) {
// Modify the toolbar settings by reference. The values in
// $form_state->getValue(array('editor', 'settings')) will be saved directly
// by editor_form_filter_admin_format_submit().
$toolbar_settings =& $form_state
->getValue(array(
'editor',
'settings',
'toolbar',
));
// The rows key is not built into the form structure, so decode the button
// groups data into this new key and remove the button_groups key.
$toolbar_settings['rows'] = json_decode($toolbar_settings['button_groups'], TRUE);
unset($toolbar_settings['button_groups']);
// Remove the plugin settings' vertical tabs state; no need to save that.
if ($form_state
->hasValue(array(
'editor',
'settings',
'plugins',
))) {
$form_state
->unsetValue(array(
'editor',
'settings',
'plugin_settings',
));
}
}