You are here

public function CKEditor::buildToolbarJSSetting in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/ckeditor/src/Plugin/Editor/CKEditor.php \Drupal\ckeditor\Plugin\Editor\CKEditor::buildToolbarJSSetting()

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

Parameters

\Drupal\editor\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 core/modules/ckeditor/src/Plugin/Editor/CKEditor.php
Returns JavaScript settings to be attached.

File

core/modules/ckeditor/src/Plugin/Editor/CKEditor.php, line 392
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();
  $settings = $editor
    ->getSettings();
  foreach ($settings['toolbar']['rows'] as $row) {
    foreach ($row as $group) {
      $toolbar[] = $group;
    }
    $toolbar[] = '/';
  }
  return $toolbar;
}