function Alignment::getElementsSubset
Same name in other branches
- 9 core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Alignment.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Alignment::getElementsSubset()
- 11.x core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Alignment.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\Alignment::getElementsSubset()
Overrides CKEditor5PluginElementsSubsetInterface::getElementsSubset
File
-
core/
modules/ ckeditor5/ src/ Plugin/ CKEditor5Plugin/ Alignment.php, line 111
Class
- Alignment
- CKEditor 5 Alignment plugin.
Namespace
Drupal\ckeditor5\Plugin\CKEditor5PluginCode
public function getElementsSubset() : array {
$enabled_alignments = $this->configuration['enabled_alignments'];
$plugin_definition = $this->getPluginDefinition();
$all_elements = $plugin_definition->getElements();
$subset = HTMLRestrictions::fromString(implode($all_elements));
foreach ($plugin_definition->getCKEditor5Config()['alignment']['options'] as $configured_alignment) {
if (!in_array($configured_alignment['name'], $enabled_alignments, TRUE)) {
$element_string = '<$text-container class=' . '"' . $configured_alignment["className"] . '"' . '>';
$subset = $subset->diff(HTMLRestrictions::fromString($element_string));
}
}
return $subset->toCKEditor5ElementsArray();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.