function CKEditor5PluginDefinition::__construct

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

CKEditor5PluginDefinition constructor.

Parameters

array $definition: An array of values from the annotation/YAML.

Throws

\InvalidArgumentException

File

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

Class

CKEditor5PluginDefinition
Provides an implementation of a CKEditor 5 plugin definition.

Namespace

Drupal\ckeditor5\Plugin

Code

public function __construct(array $definition) {
    foreach ($definition as $property => $value) {
        if (property_exists($this, $property)) {
            $this->{$property} = $value;
        }
        else {
            throw new \InvalidArgumentException(sprintf('Property %s with value %s does not exist on %s.', $property, $value, __CLASS__));
        }
    }
}

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