Skip to content
Snippets Groups Projects
Verified Commit c766b87f authored by catch's avatar catch Committed by Alex Pott
Browse files

Issue #3283776 by Wim Leers, lauriii: Make...

Issue #3283776 by Wim Leers, lauriii: Make CKEditor5PluginDefinition::getElements() consistent with CKEditor5PluginDefinition::get*()

(cherry picked from commit ee3835bc)
parent fd30ec0b
Branches
Tags
9 merge requests!4488Issue #3376281: Random machine names no longer need to be wrapped in strtolower(),!3149Issue #3282285: Email "" does not comply with addr-spec of RFC 2822,!3000Issue #793660: Check for failure of hook_install,!2940Issue #3320240: Entity count query returns a string instead of int,!2937Issue #3315245: Order of languages overrides default language fallback,!2877Issue #3056652 by yogeshmpawar, mashermike, aalin, ranjith_kumar_k_u: Link...,!1627Issue #3082958: Add gitignore(s) to composer-ready project templates,!1014Issue #3226806: Move filter implementations from filter.module to plugin classes,!939Issue #2971209: Allow the MediaLibraryUiBuilder service to use an alternative view display
......@@ -444,13 +444,18 @@ public function hasAdminLibrary(): bool {
/**
* Gets the list of elements and attributes this plugin allows to create/edit.
*
* @return string[]|false
* FALSE if this plugin does not create/edit any elements or attributes.
* Otherwise a list.
* @return string[]
* A list of elements and attributes.
*
* @see \Drupal\ckeditor5\Annotation\DrupalAspectsOfCKEditor5Plugin::$elements
*
* @throws \LogicException
* When called on a plugin definition that has no elements.
*/
public function getElements() {
public function getElements(): array {
if (!$this->hasElements()) {
throw new \LogicException('::getElements() should only be called if ::hasElements() returns TRUE.');
}
return $this->drupal['elements'];
}
......@@ -498,7 +503,7 @@ public static function isCreatableElement(string $element): bool {
* @see \Drupal\ckeditor5\Annotation\DrupalAspectsOfCKEditor5Plugin::$elements
*/
public function hasElements(): bool {
return $this->getElements() !== FALSE;
return $this->drupal['elements'] !== FALSE;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment