isValidToolbarItem example


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

    if ($toolbar_item === NULL) {
      return;
    }

    if (!static::isValidToolbarItem($toolbar_item)) {
      $this->context->buildViolation($constraint->message)
        ->setParameter('%toolbar_item', $toolbar_item)
        ->setInvalidValue($toolbar_item)
        ->addViolation();
    }
  }

  /** * Validates the given toolbar item. * * @param string $toolbar_item * A toolbar item as expected by CKEditor 5. * * @return bool * Whether the given toolbar item is valid or not. */
Home | Imprint | This part of the site doesn't use cookies.