You are here

function vsf_manualcrop_image_form in Visual select file 7

Form callback for file/%file/vsf_manualcrop/%image_style.

1 string reference to 'vsf_manualcrop_image_form'
vsf_manualcrop_menu in submodules/vsf_manualcrop/vsf_manualcrop.module
Implements hook_menu().

File

submodules/vsf_manualcrop/vsf_manualcrop.module, line 44

Code

function vsf_manualcrop_image_form($form, &$form_state, $file, $style) {
  $form_state['file'] = $file;
  $form_state['style'] = $style;
  $style_name = $style['name'];
  $form_state['vsf_from'] = @json_decode(@$_GET['vsf_from'], TRUE) ?: array();
  $form['preview'] = array(
    '#theme' => 'image_style',
    '#style_name' => 'thumbnail',
    '#path' => $file->uri,
  );
  $settings = array(
    'manualcrop_enable' => 1,
    'manualcrop_thumblist' => 0,
    'manualcrop_inline_crop' => 0,
    'manualcrop_crop_info' => 1,
    'manualcrop_instant_preview' => 0,
    'manualcrop_instant_crop' => 0,
    'manualcrop_default_crop_area' => 1,
    'manualcrop_styles_mode' => 'exclude',
    'manualcrop_styles_list' => array(
      rand(),
    ),
    'manualcrop_require_cropping' => array(
      $style_name => $style_name,
    ),
  );
  $form_state['manualcrop_data'] = array();

  // Manual Crop 1.4
  if (function_exists('manualcrop_croptool_prepare_form')) {
    $js_identifier = 'vsf_image';
    manualcrop_croptool_prepare_form($form, $form_state, $js_identifier, $settings);
    manualcrop_croptool_process($form, $form_state, $js_identifier, $file, NULL, $settings, 'preview');
  }
  else {
    manualcrop_croptool_process($form, $form_state, $form, $file, $settings);
  }
  $form['actions']['#type'] = 'actions';
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  $form['actions']['cancel'] = array(
    '#type' => 'link',
    '#href' => 'node',
    '#title' => t('Go back'),
    '#attributes' => array(
      'onclick' => 'history.go(-1); return false',
    ),
  );
  $form['#submit'][] = 'vsf_manualcrop_image_form_submit';
  return $form;
}