You are here

function _imagefield_add_cropinfo_fields in Imagefield Crop 7

1 call to _imagefield_add_cropinfo_fields()
imagefield_crop_widget_process in ./imagefield_crop.module
An element #process callback for the imagefield_crop field type.

File

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

Code

function _imagefield_add_cropinfo_fields($fid = NULL) {
  $defaults = imagefield_crop_file_settings($fid);
  $defaults['changed'] = 0;
  if ($fid) {
    $crop_info = variable_get('imagefield_crop_info', array());
    if (isset($crop_info[$fid]) && !empty($crop_info[$fid])) {
      $defaults = array_merge($defaults, $crop_info[$fid]);
    }
  }
  foreach ($defaults as $name => $default) {
    $element[$name] = array(
      '#type' => 'hidden',
      '#title' => $name,
      '#attributes' => array(
        'class' => array(
          'edit-image-crop-' . $name,
        ),
      ),
      '#default_value' => $default,
    );
  }
  return $element;
}