You are here

function imagefield_crop_field_widget_form in Imagefield Crop 7

Same name and namespace in other branches
  1. 7.3 imagefield_crop.module \imagefield_crop_field_widget_form()
  2. 7.2 imagefield_crop.module \imagefield_crop_field_widget_form()

Implements hook_field_widget_form().

File

./imagefield_crop.module, line 203
Provide a widget to crop uploaded image.

Code

function imagefield_crop_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
  $elements = image_field_widget_form($form, $form_state, $field, $instance, $langcode, $items, $delta, $element);
  foreach (element_children($elements) as $delta) {

    // Add all extra functionality provided by the imagefield_crop widget.
    $elements[$delta]['#process'][] = 'imagefield_crop_widget_process';

    // Register our value callback.
    $elements[$delta]['#file_value_callbacks'] = array_merge(array(
      'imagefield_crop_widget_value',
    ), element_info_property('managed_file', '#file_value_callbacks', array()));
  }
  return $elements;
}