You are here

function bueditor_textarea in BUEditor 6

Same name and namespace in other branches
  1. 5 bueditor.module \bueditor_textarea()
  2. 6.2 bueditor.module \bueditor_textarea()
  3. 7 bueditor.module \bueditor_textarea()

Integrate the editor into textareas.

1 string reference to 'bueditor_textarea'
bueditor_elements in ./bueditor.module
Implementation of hook_elements().

File

./bueditor.module, line 125

Code

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

  //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;
}