You are here

function image_hotspots_form_field_ui_submit in Image Hotspots 7.2

Save field name with hotspots.

1 string reference to 'image_hotspots_form_field_ui_submit'
image_hotspots_form_field_ui_field_edit_form_alter in ./image_hotspots.module
Implements hook_form_BASE_FORM_ID_alter().

File

./image_hotspots.module, line 125
Main function of module.

Code

function image_hotspots_form_field_ui_submit($form, $form_state) {
  $hotspot_fields = variable_get('image_hotspot_fields', array());
  $content_type = $form_state['values']['instance']['bundle'];
  $field_name = $form_state['values']['instance']['field_name'];
  if ($form_state['values']['instance']['settings']['image_hotspot']) {
    $hotspot_settings = $form_state['values']['instance']['settings']['image_hotspot_settings'];
    $hotspot_fields[$content_type][$field_name] = array(
      'field' => $field_name,
      'settings' => array(
        'min_width' => $hotspot_settings['min_resolution']['image_hotspots_min_width'],
        'min_height' => $hotspot_settings['min_resolution']['image_hotspots_min_height'],
        'max_width' => $hotspot_settings['max_resolution']['image_hotspots_max_width'],
        'max_height' => $hotspot_settings['max_resolution']['image_hotspots_max_height'],
        'linkable' => $hotspot_settings['linkable'],
      ),
    );
    variable_set('image_hotspot_fields', $hotspot_fields);
  }
  elseif (isset($hotspot_fields[$content_type][$field_name])) {
    unset($hotspot_fields[$content_type][$field_name]);
    variable_set('image_hotspot_fields', $hotspot_fields);
  }
}