You are here

public function BUEditorEditor::getJS in BUEditor 8

Same name and namespace in other branches
  1. 8.2 src/Entity/BUEditorEditor.php \Drupal\bueditor\Entity\BUEditorEditor::getJS()

Returns JS data including settings and libraries.

2 calls to BUEditorEditor::getJS()
BUEditorEditor::getJSSettings in src/Entity/BUEditorEditor.php
Returns JS settings.
BUEditorEditor::getLibraries in src/Entity/BUEditorEditor.php
Returns JS libraries.

File

src/Entity/BUEditorEditor.php, line 124

Class

BUEditorEditor
Defines the BUEditor Editor entity.

Namespace

Drupal\bueditor\Entity

Code

public function getJS(Editor $editor = NULL) {
  if (!isset($this->js)) {
    $this->js = [
      'libraries' => [
        'bueditor/drupal.bueditor',
      ],
      'settings' => array_filter($this
        ->getSettings()) + [
        'toolbar' => [],
      ],
    ];
    \Drupal::service('plugin.manager.bueditor.plugin')
      ->alterEditorJS($this->js, $this, $editor);
  }
  return $this->js;
}