public function CKEditor5PluginDefinition::__construct in Drupal 10
CKEditor5PluginDefinition constructor.
Parameters
array $definition: An array of values from the annotation/YAML.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
File
- core/
modules/ ckeditor5/ src/ Plugin/ CKEditor5PluginDefinition.php, line 45
Class
- CKEditor5PluginDefinition
- Provides an implementation of a CKEditor 5 plugin definition.
Namespace
Drupal\ckeditor5\PluginCode
public function __construct(array $definition) {
$this->id = $id = $definition['id'];
$expected_prefix = sprintf("%s_", $definition['provider']);
if (strpos($id, $expected_prefix) !== 0) {
throw new InvalidPluginDefinitionException($id, sprintf('The "%s" CKEditor 5 plugin definition must have a plugin ID that starts with "%s".', $id, $expected_prefix));
}
$this->provider = $definition['provider'];
static::validateCKEditor5Aspects($id, $definition);
$this->ckeditor5 = $definition['ckeditor5'];
$this
->validateDrupalAspects($id, $definition);
$this->drupal = $definition['drupal'];
}