You are here

function _bueditor_textarea in BUEditor 7

Same name and namespace in other branches
  1. 6.2 bueditor.inc \_bueditor_textarea()

Integrate the editor into textarea element.

1 call to _bueditor_textarea()
bueditor_textarea in ./bueditor.module
Integrate the editor into a textarea element.

File

./bueditor.inc, line 76
Implements commonly used functions for bueditor.

Code

function _bueditor_textarea($element, $form_state) {
  static $editors, $textareas = array();
  if (isset($textareas[$element['#id']])) {
    return $element;
  }
  $textareas[$element['#id']] = TRUE;

  // Get editors
  if (!isset($editors)) {
    $editors = bueditor_user_eids($GLOBALS['user']);
    $editors[0] = bueditor_check_page($_GET['q'], $editors[0]);
  }

  // If the first editor does not settle try the second.
  if (!bueditor_preset_textarea($element['#id'], $editors[0]) && $editors[1]) {
    if (!isset($editors[1]->eid)) {
      $editors[1] = bueditor_check_page($_GET['q'], $editors[1]);
    }
    bueditor_preset_textarea($element['#id'], $editors[1]);
  }
  return $element;
}