private static function Heading::generateCheckboxForHeadingOption in Drupal 10
Generates checkbox for a CKEditor 5 heading plugin config option.
Parameters
array $heading_option: A heading option configuration as the CKEditor 5 Heading plugin expects in its configuration.
Return value
array The checkbox render array.
See also
https://ckeditor.com/docs/ckeditor5/latest/api/module_heading_heading-He...
File
- core/
modules/ ckeditor5/ src/ Plugin/ CKEditor5Plugin/ Heading.php, line 148
Class
- Heading
- CKEditor 5 Heading plugin.
Namespace
Drupal\ckeditor5\Plugin\CKEditor5PluginCode
private static function generateCheckboxForHeadingOption(array $heading_option) : array {
// This requires the `title` and `model` properties. The `class` property is
// optional. The `view` property is not used.
assert(array_key_exists('title', $heading_option));
assert(array_key_exists('model', $heading_option));
$checkbox = [
'#type' => 'checkbox',
'#title' => $heading_option['title'],
'#return_value' => $heading_option['model'],
];
if (isset($heading_option['class'])) {
$checkbox['#label_attributes']['class'][] = $heading_option['class'];
$checkbox['#label_attributes']['class'][] = 'ck';
}
return $checkbox;
}