isUnrestricted example

case 'JustifyBlock':
        if (!isset($alignment_mapped)) {
          $alignment_mapped = TRUE;
          return ['alignment'];
        }
        return NULL;

      case 'HorizontalRule':
        return ['horizontalLine'];

      case 'Format':
        if ($text_format_html_restrictions->isUnrestricted()) {
          // When no restrictions exist, all tags possibly supported by "Format"           // in CKEditor 4 must be supported.           return ['heading', 'codeBlock'];
        }
        $allowed_elements = $text_format_html_restrictions->getAllowedElements();
        // Check if <h*> is supported.         // Merely checking the existence of the array key is sufficient; this         // plugin does not set or need any additional attributes.         // @see \Drupal\filter\Plugin\FilterInterface::getHTMLRestrictions()         $intersect = array_intersect(['h2', 'h3', 'h4', 'h5', 'h6']array_keys($allowed_elements));

        
/** * Checks that fundamental CKEditor 5 plugins' HTML tags are allowed. * * @param \Drupal\filter\FilterFormatInterface $text_format * The text format to validate. * @param \Drupal\ckeditor5\Plugin\Validation\Constraint\FundamentalCompatibilityConstraint $constraint * The constraint to validate. */
  private function checkHtmlRestrictionsAreCompatible(FilterFormatInterface $text_format, FundamentalCompatibilityConstraint $constraint): void {
    $html_restrictions = HTMLRestrictions::fromTextFormat($text_format);
    if ($html_restrictions->isUnrestricted()) {
      return;
    }

    $fundamental = new HTMLRestrictions($this->pluginManager->getProvidedElements(self::FUNDAMENTAL_CKEDITOR5_PLUGINS));
    if (!$fundamental->diff($html_restrictions)->allowsNothing()) {
      $offending_filter = static::findHtmlRestrictorFilterNotAllowingTags($text_format$fundamental);
      $this->context->buildViolation($constraint->nonAllowedElementsMessage)
        ->setParameter('%filter_label', (string) $offending_filter->getLabel())
        ->setParameter('%filter_plugin_id', $offending_filter->getPluginId())
        ->addViolation();
    }
  }
Home | Imprint | This part of the site doesn't use cookies.