You are here

function imceimage_widget in Imce CCK Image 6.2

Same name and namespace in other branches
  1. 6 imceimage.module \imceimage_widget()

Implements hook_widget()

This does not do anything much and instead just uses the element type imceimage defined in hook_elements - also include the javscript file for integrating with imce module.

File

./imceimage.module, line 276

Code

function imceimage_widget(&$form, &$form_state, $field, $items, $delta = 0) {
  static $inc_js = FALSE;
  if (!$inc_js) {
    drupal_add_js(drupal_get_path('module', 'imceimage') . '/js/imceimage.js');
    drupal_add_js(array(
      'imceimage' => array(
        'url' => url('imceimage/verify'),
      ),
    ), 'setting');
    $inc_js = TRUE;
  }
  $element = array(
    '#type' => 'imceimage',
    '#default_value' => isset($items[$delta]) ? $items[$delta] : array(),
  );
  return $element;
}