You are here

public function BidiCKEditorButton::getButtons in CKEditor BiDi Buttons 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/CKEditorPlugin/BidiCKEditorButton.php \Drupal\ckeditor_bidi\Plugin\CKEditorPlugin\BidiCKEditorButton::getButtons()
  2. 3.x src/Plugin/CKEditorPlugin/BidiCKEditorButton.php \Drupal\ckeditor_bidi\Plugin\CKEditorPlugin\BidiCKEditorButton::getButtons()

NOTE: The keys of the returned array corresponds to the CKEditor button names. They are the first argument of the editor.ui.addButton() or editor.ui.addRichCombo() functions in the plugin.js file.

Overrides CKEditorPluginButtonsInterface::getButtons

File

src/Plugin/CKEditorPlugin/BidiCKEditorButton.php, line 34
Contains \Drupal\ckeditor_bidi\Plugin\CKEditorPlugin\BidiCKEditorButton.

Class

BidiCKEditorButton
Defines the "bidi" plugin.

Namespace

Drupal\ckeditor_bidi\Plugin\CKEditorPlugin

Code

public function getButtons() {

  // Make sure that the path to the image matches the file structure of
  // the CKEditor plugin you are implementing.
  $path = 'libraries/bidi';

  // Support for "Libaraies API" module.
  if (\Drupal::moduleHandler()
    ->moduleExists('libraries')) {
    $path = libraries_get_path('bidi');
  }
  return array(
    'BidiLtr' => array(
      'label' => $this
        ->t('Text direction from left to right'),
      'image' => $path . '/icons/bidiltr.png',
    ),
    'BidiRtl' => array(
      'label' => $this
        ->t('Text direction from right to left'),
      'image' => $path . '/icons/bidirtl.png',
    ),
  );
}