You are here

public property DrupalAspectsOfCKEditor5Plugin::$elements in Drupal 10

List of elements and attributes provided.

An array of strings, or false if no elements are provided.

Syntax for each array value:

  • <element> only allows that HTML element with no attributes
  • <element attrA attrB> only allows that HTML element with attributes attrA and attrB, and any value for those attributes.
  • <element attrA="foo bar baz" attrB="qux-*"> only allows that HTML element with attributes attrA (if attrA contains one of the three listed values) and attrB (if its value has the provided prefix).
  • <element data-*> only allows that HTML element with any attribute that has the given prefix.

Note that <element> means such an element (tag) can be created, whereas <element attrA attrB> means that `attrA` and `attrB` can be created on the tag. If a plugin supports both creating the element as well as setting some attributes or attribute values on it, it should have distinct entries in the list. For example, for a link plugin: `<a>` and `<a href>`. The first indicates the plugin can create such tags, the second indicates it can set the `href` attribute on it. If the first were omitted, the Drupal CKEditor 5 module would interpret that as "this plugin cannot create `<a>`, it can only set the `href` attribute on it".

Type: string[]|false

See also

\Drupal\ckeditor5\Plugin\CKEditor5PluginDefinition::getCreatableElements()

File

core/modules/ckeditor5/src/Annotation/DrupalAspectsOfCKEditor5Plugin.php, line 93

Class

DrupalAspectsOfCKEditor5Plugin
Defines the "Drupal aspects of a CKEditor5Plugin" annotation object.

Namespace

Drupal\ckeditor5\Annotation

Code

public $elements;