public function CKEditor::buildToolbarJSSetting

Builds the "toolbar" configuration part of the CKEditor JS settings.

Parameters

\Drupal\editor\Plugin\Core\Entity\Editor $editor: A configured text editor object.

Return value

array An array containing the "toolbar" configuration.

See also

getJSSettings()

1 call to CKEditor::buildToolbarJSSetting()
CKEditor::getJSSettings in drupal/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php
Implements \Drupal\editor\Plugin\EditPluginInterface::getJSSettings().

File

drupal/core/modules/ckeditor/lib/Drupal/ckeditor/Plugin/Editor/CKEditor.php, line 168
Contains \Drupal\ckeditor\Plugin\Editor\CKEditor.

Class

CKEditor
Defines a CKEditor-based text editor for Drupal.

Namespace

Drupal\ckeditor\Plugin\Editor

Code

public function buildToolbarJSSetting(EditorEntity $editor) {
  $toolbar = array();
  foreach ($editor->settings['toolbar']['buttons'] as $row_number => $row) {
    $button_group = array();
    foreach ($row as $button_name) {

      // Change the toolbar separators into groups.
      if ($button_name === '|') {
        $toolbar[] = $button_group;
        $button_group = array();
      }
      else {
        $button_group['items'][] = $button_name;
      }
    }
    $toolbar[] = $button_group;
    $toolbar[] = '/';
  }
  return $toolbar;
}