function Style::validateConfigurationForm
Same name in other branches
- 9 core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Style.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Style::validateConfigurationForm()
- 10 core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Style.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Style::validateConfigurationForm()
File
-
core/
modules/ ckeditor5/ src/ Plugin/ CKEditor5Plugin/ Style.php, line 68
Class
- Style
- CKEditor 5 Style plugin configuration.
Namespace
Drupal\ckeditor5\Plugin\CKEditor5PluginCode
public function validateConfigurationForm(array &$form, FormStateInterface $form_state) {
// Match the config schema structure at ckeditor5.plugin.ckeditor5_style.
$form_value = $form_state->getValue('styles');
[
$styles,
$invalid_lines,
] = self::parseStylesFormValue($form_value);
if (!empty($invalid_lines)) {
$line_numbers = array_keys($invalid_lines);
$form_state->setError($form['styles'], $this->formatPlural(count($invalid_lines), 'Line @line-number does not contain a valid value. Enter a valid CSS selector containing one or more classes, followed by a pipe symbol and a label.', 'Lines @line-numbers do not contain a valid value. Enter a valid CSS selector containing one or more classes, followed by a pipe symbol and a label.', [
'@line-number' => reset($line_numbers),
'@line-numbers' => implode(', ', $line_numbers),
]));
}
$form_state->setValue('styles', $styles);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.