You are here

public function CKEditor5PluginDefinition::getCreatableElements in Drupal 10

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 473

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',
  ]);
}