You are here

public function Imce::alterEditorJS in IMCE 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/BUEditorPlugin/Imce.php \Drupal\imce\Plugin\BUEditorPlugin\Imce::alterEditorJS()

File

src/Plugin/BUEditorPlugin/Imce.php, line 26

Class

Imce
Defines Imce as a BUEditor plugin.

Namespace

Drupal\imce\Plugin\BUEditorPlugin

Code

public function alterEditorJS(array &$js, BUEditorEditor $bueditor_editor, Editor $editor = NULL) {

  // Check selected file browser.
  if (isset($js['settings']['fileBrowser']) && $js['settings']['fileBrowser'] === 'imce') {

    // Check access.
    if (ImceMain::access()) {
      $js['libraries'][] = 'imce/drupal.imce.bueditor';
    }
    else {
      unset($js['settings']['fileBrowser']);
    }
  }
}