You are here

function asset_widget_imagefield_crop_widget_process in Asset 7

Custom process callback for imagecrop fields. Needed to reduce crop area size.

1 string reference to 'asset_widget_imagefield_crop_widget_process'
asset_widget_field_widget_imagefield_crop_widget_form_alter in modules/asset_widget/asset_widget.module
Implements hook_field_widget_imagefield_crop_widget_form().

File

modules/asset_widget/asset_widget.module, line 1030
Code for the Asset widget module.

Code

function asset_widget_imagefield_crop_widget_process($element) {
  if ($element['#attached']['js'] && !empty($element['#file']) && asset_widget_in_frame_form()) {
    foreach ($element['#attached']['js'] as &$js_item) {
      if (is_array($js_item) && $js_item['type'] == 'setting') {
        foreach ($js_item['data']['imagefield_crop'] as &$field_setting) {
          if (isset($field_setting['box'])) {
            $field_setting['box']['box_width'] = $field_setting['box']['box_height'] = 300;
          }
        }
      }
    }
  }
  return $element;
}