function image_hotspots_form_field_ui_field_edit_form_alter in Image Hotspots 7.2
Implements hook_form_BASE_FORM_ID_alter().
File
- ./
image_hotspots.module, line 49 - Main function of module.
Code
function image_hotspots_form_field_ui_field_edit_form_alter(&$form, &$form_state) {
if ($form['#field']['type'] == 'image') {
$hotspot_fields = variable_get('image_hotspot_fields', array());
$hotspot_field_settings = array();
if (isset($hotspot_fields[$form['instance']['bundle']['#value']][$form['instance']['field_name']['#value']]['settings'])) {
$hotspot_field_settings = $hotspot_fields[$form['instance']['bundle']['#value']][$form['instance']['field_name']['#value']]['settings'];
}
$form['instance']['settings']['image_hotspot'] = array(
'#type' => 'checkbox',
'#title' => t('Use image hotspots'),
'#weight' => 12,
'#default_value' => isset($hotspot_fields[$form['instance']['bundle']['#value']][$form['instance']['field_name']['#value']]) ? TRUE : FALSE,
);
$form['instance']['settings']['image_hotspot_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Image hotspot settings'),
'#states' => array(
'invisible' => array(
':input[name="instance[settings][image_hotspot]"]' => array(
'checked' => FALSE,
),
),
),
'#weight' => 13,
);
$form['instance']['settings']['image_hotspot_settings']['max_resolution'] = array(
'#type' => 'item',
'#title' => t('Maximum hotspot resolution'),
'#field_prefix' => '<div class="container-inline">',
'#field_suffix' => '</div>',
'#description' => t('The maximum allowed hotspot size expressed as WIDTHxHEIGHT (e.g. 640x480).'),
);
$form['instance']['settings']['image_hotspot_settings']['max_resolution']['image_hotspots_max_width'] = array(
'#type' => 'textfield',
'#field_suffix' => ' x ',
'#size' => 10,
'#element_validate' => array(
'element_validate_integer_positive',
),
'#default_value' => isset($hotspot_field_settings['max_width']) ? $hotspot_field_settings['max_width'] : '',
);
$form['instance']['settings']['image_hotspot_settings']['max_resolution']['image_hotspots_max_height'] = array(
'#type' => 'textfield',
'#size' => 10,
'#element_validate' => array(
'element_validate_integer_positive',
),
'#default_value' => isset($hotspot_field_settings['max_height']) ? $hotspot_field_settings['max_height'] : '',
);
$form['instance']['settings']['image_hotspot_settings']['min_resolution'] = array(
'#type' => 'item',
'#title' => t('Minimum hotspot resolution'),
'#field_prefix' => '<div class="container-inline">',
'#field_suffix' => '</div>',
'#description' => t('The minimum allowed hotpost size expressed as WIDTHxHEIGHT (e.g. 640x480).'),
);
$form['instance']['settings']['image_hotspot_settings']['min_resolution']['image_hotspots_min_width'] = array(
'#type' => 'textfield',
'#size' => 10,
'#element_validate' => array(
'element_validate_integer_positive',
),
'#default_value' => isset($hotspot_field_settings['min_width']) ? $hotspot_field_settings['min_width'] : '',
'#field_suffix' => ' x ',
);
$form['instance']['settings']['image_hotspot_settings']['min_resolution']['image_hotspots_min_height'] = array(
'#type' => 'textfield',
'#size' => 10,
'#element_validate' => array(
'element_validate_integer_positive',
),
'#default_value' => isset($hotspot_field_settings['min_height']) ? $hotspot_field_settings['min_height'] : '',
);
$form['instance']['settings']['image_hotspot_settings']['linkable'] = array(
'#type' => 'checkbox',
'#title' => t('Hotposts may have link to URL'),
'#default_value' => isset($hotspot_field_settings['linkable']) ? $hotspot_field_settings['linkable'] : FALSE,
);
$form['#submit'][] = 'image_hotspots_form_field_ui_submit';
}
}