$tag =
array_keys($style_element->
getAllowedElements())[0
];
$classes =
array_keys($style_element->
getAllowedElements()[$tag]['class'
]);
return [$tag,
$classes];
} /**
* {@inheritdoc}
*/
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,
$unparseable_lines] = self::
parseStylesFormValue($form_value);
if (!
empty($unparseable_lines)) { $line_numbers =
array_keys($unparseable_lines);
$form_state->
setError($form['styles'
],
$this->
formatPlural( count($unparseable_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),
] ));
}