You are here

public function CKEditorPluginManager::getButtons in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/ckeditor/src/CKEditorPluginManager.php \Drupal\ckeditor\CKEditorPluginManager::getButtons()
  2. 9 core/modules/ckeditor/src/CKEditorPluginManager.php \Drupal\ckeditor\CKEditorPluginManager::getButtons()

Retrieves all available CKEditor buttons, keyed by plugin ID.

Return value

array All available CKEditor buttons, with plugin IDs as keys and button metadata (as implemented by getButtons()) as values.

See also

\Drupal\ckeditor\CKEditorPluginButtonsInterface::getButtons()

File

core/modules/ckeditor/src/CKEditorPluginManager.php, line 141

Class

CKEditorPluginManager
Provides a CKEditor Plugin plugin manager.

Namespace

Drupal\ckeditor

Code

public function getButtons() {
  $plugins = array_keys($this
    ->getDefinitions());
  $buttons_plugins = [];
  foreach ($plugins as $plugin_id) {
    $plugin = $this
      ->createInstance($plugin_id);
    if ($plugin instanceof CKEditorPluginButtonsInterface) {
      $buttons_plugins[$plugin_id] = $plugin
        ->getButtons();
    }
  }
  return $buttons_plugins;
}