function ToolbarItemConditionsMetConstraintValidator::findDefinitionForToolbarItem

Same name in other branches
  1. 9 core/modules/ckeditor5/src/Plugin/Validation/Constraint/ToolbarItemConditionsMetConstraintValidator.php \Drupal\ckeditor5\Plugin\Validation\Constraint\ToolbarItemConditionsMetConstraintValidator::findDefinitionForToolbarItem()
  2. 11.x core/modules/ckeditor5/src/Plugin/Validation/Constraint/ToolbarItemConditionsMetConstraintValidator.php \Drupal\ckeditor5\Plugin\Validation\Constraint\ToolbarItemConditionsMetConstraintValidator::findDefinitionForToolbarItem()

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\Constraint

Code

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.");
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.