function SourceEditingRedundantTagsConstraintValidator::tagHasAttributeRestrictions

Same name and namespace in other branches
  1. 10 core/modules/ckeditor5/src/Plugin/Validation/Constraint/SourceEditingRedundantTagsConstraintValidator.php \Drupal\ckeditor5\Plugin\Validation\Constraint\SourceEditingRedundantTagsConstraintValidator::tagHasAttributeRestrictions()
  2. 11.x core/modules/ckeditor5/src/Plugin/Validation/Constraint/SourceEditingRedundantTagsConstraintValidator.php \Drupal\ckeditor5\Plugin\Validation\Constraint\SourceEditingRedundantTagsConstraintValidator::tagHasAttributeRestrictions()

Inspects whether the given tag has attribute restrictions.

Parameters

\Drupal\ckeditor5\HTMLRestrictions $r: A set of HTML restrictions to inspect.

string $tag_name: The tag to check for attribute restrictions in $r.

Return value

bool TRUE if the given tag has attribute restrictions, FALSE otherwise.

1 call to SourceEditingRedundantTagsConstraintValidator::tagHasAttributeRestrictions()
SourceEditingRedundantTagsConstraintValidator::validate in core/modules/ckeditor5/src/Plugin/Validation/Constraint/SourceEditingRedundantTagsConstraintValidator.php

File

core/modules/ckeditor5/src/Plugin/Validation/Constraint/SourceEditingRedundantTagsConstraintValidator.php, line 158

Class

SourceEditingRedundantTagsConstraintValidator
Ensures tags already available via plugin are not be added to Source Editing.

Namespace

Drupal\ckeditor5\Plugin\Validation\Constraint

Code

private static function tagHasAttributeRestrictions(HTMLRestrictions $r, string $tag_name) : bool {
    $all_elements = $r->getAllowedElements(FALSE);
    assert(isset($all_elements[$tag_name]));
    return is_array($r->getAllowedElements(FALSE)[$tag_name]);
}

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