You are here

function _bueditor_textarea in BUEditor 6.2

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

Integrate the editor into textareas.

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

File

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

Code

function _bueditor_textarea($element) {
  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;
}