function ToolbarItemConstraintValidator::isValidToolbarItem
Same name in other branches
- 9 core/modules/ckeditor5/src/Plugin/Validation/Constraint/ToolbarItemConstraintValidator.php \Drupal\ckeditor5\Plugin\Validation\Constraint\ToolbarItemConstraintValidator::isValidToolbarItem()
- 11.x core/modules/ckeditor5/src/Plugin/Validation/Constraint/ToolbarItemConstraintValidator.php \Drupal\ckeditor5\Plugin\Validation\Constraint\ToolbarItemConstraintValidator::isValidToolbarItem()
Validates the given toolbar item.
Parameters
string $toolbar_item: A toolbar item as expected by CKEditor 5.
Return value
bool Whether the given toolbar item is valid or not.
1 call to ToolbarItemConstraintValidator::isValidToolbarItem()
- ToolbarItemConstraintValidator::validate in core/
modules/ ckeditor5/ src/ Plugin/ Validation/ Constraint/ ToolbarItemConstraintValidator.php
File
-
core/
modules/ ckeditor5/ src/ Plugin/ Validation/ Constraint/ ToolbarItemConstraintValidator.php, line 53
Class
- ToolbarItemConstraintValidator
- Toolbar item constraint validator.
Namespace
Drupal\ckeditor5\Plugin\Validation\ConstraintCode
protected function isValidToolbarItem(string $toolbar_item) : bool {
// Special case: the toolbar group separator.
// @see https://ckeditor.com/docs/ckeditor5/latest/features/toolbar/toolbar.html#separating-toolbar-items
if ($toolbar_item === '|') {
return TRUE;
}
// Special case: the breakpoint separator.
// @see https://ckeditor.com/docs/ckeditor5/latest/features/toolbar/toolbar.html#explicit-wrapping-breakpoint
if ($toolbar_item === '-') {
return TRUE;
}
$available_toolbar_items = array_keys($this->pluginManager
->getToolbarItems());
return in_array($toolbar_item, $available_toolbar_items, TRUE);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.