You are here

public function Media::getElementsSubset in Drupal 10

File

core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Media.php, line 196

Class

Media
CKEditor 5 Media plugin.

Namespace

Drupal\ckeditor5\Plugin\CKEditor5Plugin

Code

public function getElementsSubset() : array {
  $all_elements = $this
    ->getPluginDefinition()
    ->getElements();
  $subset = HTMLRestrictions::fromString(implode($all_elements));
  $view_mode_override_enabled = $this
    ->getConfiguration()['allow_view_mode_override'];
  if (!$view_mode_override_enabled) {
    $subset = $subset
      ->diff(HTMLRestrictions::fromString('<drupal-media data-view-mode>'));
  }

  // @todo Simplify in https://www.drupal.org/project/drupal/issues/3278636, that will allow removing all uses of HTMLRestrictions in this class.
  return array_merge([
    '<drupal-media>',
  ], $subset
    ->toCKEditor5ElementsArray());
}