You are here

public function elFinder::alterEditorForm in elFinder file manager 8.2

File

src/Plugin/BUEditorPlugin/elFinder.php, line 41
Contains \Drupal\elfinder\Plugin\BUEditorPlugin\elFinder.

Class

elFinder
Defines elFinder as a BUEditor plugin.

Namespace

Drupal\elfinder\Plugin\BUEditorPlugin

Code

public function alterEditorForm(array &$form, FormStateInterface $form_state, BUEditorEditor $bueditor_editor) {

  // Add elFinder option to file browser field.
  $fb =& $form['settings']['fileBrowser'];
  $fb['#options']['elfinder'] = $this
    ->t('elFinder');

  // Add configuration link
  $form['settings']['elfinder'] = array(
    '#type' => 'container',
    '#states' => array(
      'visible' => array(
        ':input[name="settings[fileBrowser]"]' => array(
          'value' => 'elfinder',
        ),
      ),
    ),
    '#attributes' => array(
      'class' => array(
        'description',
      ),
    ),
    'content' => array(
      '#markup' => $this
        ->t('Configure <a href="!url">elFinder File Manager</a>.', array(
        '!url' => \Drupal::url('elfinder.admin'),
      )),
    ),
  );

  // Set weight
  if (isset($fb['#weight'])) {
    $form['settings']['elfinder']['#weight'] = $fb['#weight'] + 0.1;
  }

  //$browserpage = elFinderPageController::buildBrowserPage(FALSE);
  drupal_set_message('99');

  //  $form['#attached']['drupalSettings']['elfinder'] = $browserpage['#attached']['drupalSettings']['elfinder'];
}