You are here

class CKEditor5Plugin in Drupal 10

Defines a CKEditor5Plugin annotation object.

Plugin Namespace: Plugin\CKEditor5Plugin.

Hierarchy

Expanded class hierarchy of CKEditor5Plugin

See also

\Drupal\ckeditor5\Plugin\CKEditor5PluginInterface

\Drupal\ckeditor5\Plugin\CKEditor5PluginManagerInterface

Plugin API

\Drupal\ckeditor5\Annotation\CKEditor5AspectsOfCKEditor5Plugin

\Drupal\ckeditor5\Annotation\DrupalAspectsOfCKEditor5Plugin

Related topics

2 files declare their use of CKEditor5Plugin
CKEditor5PluginManager.php in core/modules/ckeditor5/src/Plugin/CKEditor5PluginManager.php
SmartDefaultSettingsTest.php in core/modules/ckeditor5/tests/src/Unit/SmartDefaultSettingsTest.php
1 string reference to 'CKEditor5Plugin'
CKEditor5PluginManagerTest::providerTestInvalidPluginDefinitions in core/modules/ckeditor5/tests/src/Kernel/CKEditor5PluginManagerTest.php
Data provider.

File

core/modules/ckeditor5/src/Annotation/CKEditor5Plugin.php, line 23

Namespace

Drupal\ckeditor5\Annotation
View source
class CKEditor5Plugin extends Plugin {

  /**
   * The plugin ID.
   *
   * @var string
   */
  public $id;

  /**
   * The CKEditor 5 aspects of the plugin definition.
   *
   * @var \Drupal\ckeditor5\Annotation\CKEditor5AspectsOfCKEditor5Plugin
   */
  public $ckeditor5;

  /**
   * The Drupal aspects of the plugin definition.
   *
   * @var \Drupal\ckeditor5\Annotation\DrupalAspectsOfCKEditor5Plugin
   */
  public $drupal;

  /**
   * {@inheritdoc}
   *
   * Overridden for compatibility with the AnnotationBridgeDecorator, which
   * ensures YAML-defined CKEditor 5 plugin definitions are also processed by
   * annotations. Unfortunately it does not (yet) support nested annotations.
   * Force YAML-defined plugin definitions to be parsed by the
   * annotations, to ensure consistent handling of defaults.
   *
   * @see \Drupal\Component\Annotation\Plugin\Discovery\AnnotationBridgeDecorator::getDefinitions()
   */
  public function __construct($values) {
    if (isset($values['ckeditor5']) && is_array($values['ckeditor5'])) {
      $values['ckeditor5'] = new CKEditor5AspectsOfCKEditor5Plugin($values['ckeditor5']);
    }
    if (isset($values['drupal']) && is_array($values['drupal'])) {
      $values['drupal'] = new DrupalAspectsOfCKEditor5Plugin($values['drupal']);
    }
    parent::__construct($values);
  }

  /**
   * {@inheritdoc}
   */
  public function getClass() {
    return $this->definition['drupal']['class'];
  }

  /**
   * {@inheritdoc}
   */
  public function setClass($class) {
    $this->definition['drupal']['class'] = $class;
  }

  /**
   * {@inheritdoc}
   */
  public function get() : CKEditor5PluginDefinition {
    return new CKEditor5PluginDefinition($this->definition);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CKEditor5Plugin::$ckeditor5 public property The CKEditor 5 aspects of the plugin definition.
CKEditor5Plugin::$drupal public property The Drupal aspects of the plugin definition.
CKEditor5Plugin::$id public property The plugin ID.
CKEditor5Plugin::get public function Gets the value of an annotation. Overrides Plugin::get
CKEditor5Plugin::getClass public function Gets the class of the annotated class. Overrides Plugin::getClass
CKEditor5Plugin::setClass public function Sets the class of the annotated class. Overrides Plugin::setClass
CKEditor5Plugin::__construct public function Overridden for compatibility with the AnnotationBridgeDecorator, which ensures YAML-defined CKEditor 5 plugin definitions are also processed by annotations. Unfortunately it does not (yet) support nested annotations. Force YAML-defined plugin… Overrides Plugin::__construct
Plugin::$definition protected property The plugin definition read from the class annotation. 1
Plugin::getId public function Gets the unique ID for this annotated class. Overrides AnnotationInterface::getId
Plugin::getProvider public function Gets the name of the provider of the annotated class. Overrides AnnotationInterface::getProvider 1
Plugin::parse protected function Parses an annotation into its definition.
Plugin::setProvider public function Sets the name of the provider of the annotated class. Overrides AnnotationInterface::setProvider