function Heading::generateCheckboxForHeadingOption
Same name in other branches
- 9 core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Heading.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Heading::generateCheckboxForHeadingOption()
- 11.x core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Heading.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Heading::generateCheckboxForHeadingOption()
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-H…
1 call to Heading::generateCheckboxForHeadingOption()
- Heading::buildConfigurationForm in core/
modules/ ckeditor5/ src/ Plugin/ CKEditor5Plugin/ Heading.php - Form for choosing which heading tags are available.
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.