protected function ToolbarItemConditionsMetConstraintValidator::findDefinitionForToolbarItem in Drupal 10
Searches for CKEditor 5 plugin that provides a given toolbar item.
Parameters
string $toolbar_item: The toolbar item to be searched for within plugin definitions.
Return value
\Drupal\ckeditor5\Plugin\CKEditor5PluginDefinition The corresponding plugin definition.
Throws
\OutOfBoundsException
1 call to ToolbarItemConditionsMetConstraintValidator::findDefinitionForToolbarItem()
- ToolbarItemConditionsMetConstraintValidator::validate in core/modules/ ckeditor5/ src/ Plugin/ Validation/ Constraint/ ToolbarItemConditionsMetConstraintValidator.php 
File
- core/modules/ ckeditor5/ src/ Plugin/ Validation/ Constraint/ ToolbarItemConditionsMetConstraintValidator.php, line 125 
Class
- ToolbarItemConditionsMetConstraintValidator
- Toolbar item conditions met constraint validator.
Namespace
Drupal\ckeditor5\Plugin\Validation\ConstraintCode
protected function findDefinitionForToolbarItem(string $toolbar_item) : CKEditor5PluginDefinition {
  $definitions = $this->pluginManager
    ->getDefinitions();
  foreach ($definitions as $definition) {
    if (array_key_exists($toolbar_item, $definition
      ->getToolbarItems())) {
      return $definition;
    }
  }
  // @see \Drupal\ckeditor5\Plugin\Validation\Constraint\ToolbarItemConstraint
  throw new \OutOfBoundsException("Toolbar item '{$toolbar_item}' not found.");
}