function CKEditor5PluginDefinition::getCreatableElements

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

Gets the elements this plugin allows to create.

Return value

string[] A list of plain tags (without attributes) that this plugin can create.

Throws

\LogicException When called on a plugin definition that has no elements.

See also

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

File

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

Class

CKEditor5PluginDefinition
Provides an implementation of a CKEditor 5 plugin definition.

Namespace

Drupal\ckeditor5\Plugin

Code

public function getCreatableElements() : array {
    if (!$this->hasElements()) {
        throw new \LogicException('::getCreatableElements() should only be called if ::hasElements() returns TRUE.');
    }
    return array_filter($this->getElements(), [
        __CLASS__,
        'isCreatableElement',
    ]);
}

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