You are here

function imce_textarea in IMCE 6

Same name and namespace in other branches
  1. 6.2 imce.module \imce_textarea()
  2. 7 imce.module \imce_textarea()

Inline image/link insertion to textareas.

1 string reference to 'imce_textarea'
imce_elements in ./imce.module
Implementation of hook_elements().

File

./imce.module, line 118

Code

function imce_textarea($element) {
  static $ids;
  if (!isset($ids)) {
    $ids = FALSE;
    if (imce_access() && ($setting = str_replace(' ', '', variable_get('imce_settings_textarea', '')))) {
      $ids = array();
      foreach (explode(',', $setting) as $id) {
        $ids[$id] = 1;
      }
    }
  }
  if ($ids && isset($ids[$element['#id']])) {
    drupal_add_js(drupal_get_path('module', 'imce') . '/js/imce_set_inline.js');
    $element['#description'] .= '<div class="imce-inline-wrapper" style="display:none">' . t('Insert !image or !link.', array(
      '!image' => l(t('image'), 'imce', array(
        'attributes' => array(
          'name' => $element['#id'] . '-IMCE-image',
          'class' => 'imce-inline-image',
        ),
      )),
      '!link' => l(t('link'), 'imce', array(
        'attributes' => array(
          'name' => $element['#id'] . '-IMCE-link',
          'class' => 'imce-inline-link',
        ),
      )),
    )) . '</div>';
  }
  return $element;
}