You are here

public function BUEditorPluginManager::getButtonGroups in BUEditor 8

Same name and namespace in other branches
  1. 8.2 src/BUEditorPluginManager.php \Drupal\bueditor\BUEditorPluginManager::getButtonGroups()

Returns buttons grouped by owner plugin.

Return value

array An array of button lists keyed by plugin id.

1 call to BUEditorPluginManager::getButtonGroups()
BUEditorPluginManager::getButtons in src/BUEditorPluginManager.php
Returns buttons defined by plugins.

File

src/BUEditorPluginManager.php, line 137

Class

BUEditorPluginManager
Provides a plugin manager for BUEditor Plugins.

Namespace

Drupal\bueditor

Code

public function getButtonGroups() {
  $plugin_buttons = [];
  $definitions = $this
    ->getDefinitions();
  foreach ($this
    ->invokeAll('getButtons') as $plugin => $buttons) {
    if ($buttons) {
      foreach ($buttons as $bid => $label) {
        $buttons[$bid] = (is_array($label) ? $label : [
          'label' => $label,
        ]) + [
          'id' => $bid,
        ];
      }
      $plugin_buttons[$plugin] = [
        'label' => $definitions[$plugin]['label'],
        'buttons' => $buttons,
      ];
    }
  }
  return $plugin_buttons;
}