function CKEditor5PluginDefinition::isCreatableElement

Same name in other branches
  1. 10 core/modules/ckeditor5/src/Plugin/CKEditor5PluginDefinition.php \Drupal\ckeditor5\Plugin\CKEditor5PluginDefinition::isCreatableElement()
  2. 11.x core/modules/ckeditor5/src/Plugin/CKEditor5PluginDefinition.php \Drupal\ckeditor5\Plugin\CKEditor5PluginDefinition::isCreatableElement()

Checks if the element is a plain tag, meaning the plugin can create it.

Parameters

string $element: A single element, for example `<foo>`, `<foo bar>` or `<foo bar="baz'>`.

Return value

bool If it is a plain tag and hence a creatable element.

See also

\Drupal\ckeditor5\Annotation\DrupalAspectsOfCKEditor5Plugin::$elements

File

core/modules/ckeditor5/src/Plugin/CKEditor5PluginDefinition.php, line 519

Class

CKEditor5PluginDefinition
Provides an implementation of a CKEditor 5 plugin definition.

Namespace

Drupal\ckeditor5\Plugin

Code

public static function isCreatableElement(string $element) : bool {
    return !HTMLRestrictions::fromString($element)->getPlainTagsSubset()
        ->allowsNothing();
}

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