findDefinitionForToolbarItem example


  public function validate($toolbar_item, Constraint $constraint) {
    if (!$constraint instanceof ToolbarItemConditionsMetConstraint) {
      throw new UnexpectedTypeException($constraint, __NAMESPACE__ . '\ToolbarItemConditionsMetConstraint');
    }

    try {
      $definition = $this->findDefinitionForToolbarItem($toolbar_item);
    }
    catch (\OutOfBoundsException $e) {
      // No plugin definition found for this toolbar item. It's the       // responsibility of another validation constraint to raise this problem.       // @see \Drupal\ckeditor5\Plugin\Validation\Constraint\ToolbarItemConstraint       return;
    }

    // If there are no conditions, there is nothing to validate.     if (!$definition->hasConditions()) {
      return;
    }
Home | Imprint | This part of the site doesn't use cookies.