function imagefield_crop_field_widget_settings_form in Imagefield Crop 7.3
Same name and namespace in other branches
- 7 imagefield_crop.module \imagefield_crop_field_widget_settings_form()
- 7.2 imagefield_crop.module \imagefield_crop_field_widget_settings_form()
Implements hook_field_widget_settings_form().
File
- ./
imagefield_crop.module, line 481
Code
function imagefield_crop_field_widget_settings_form($field, $instance) {
$widget = $instance['widget'];
$settings = $widget['settings'];
// Use the image widget settings form.
$form = image_field_widget_settings_form($field, $instance);
$presets = imagefield_crop_presets_load_multiple();
$options = array();
foreach ($presets as $preset) {
$options[$preset->name] = $preset->label;
}
$form['presets'] = array(
'#type' => 'select',
'#title' => t('Presets'),
'#options' => $options,
'#default_value' => $settings['presets'],
'#multiple' => TRUE,
);
$form['hide_preview'] = array(
'#type' => 'checkbox',
'#title' => t('Hide preview'),
'#default_value' => !empty($settings['hide_preview']) ? $settings['hide_preview'] : '',
'#theme_wrappers' => array(
'form_element',
),
);
$form['preview'] = array(
'#type' => 'container',
'#title' => t('Preview size'),
'#theme_wrappers' => array(
'form_element',
),
'#description' => t('Ratio for crop area. For example 4:3 or 16:9 as width to height.'),
'#markup' => '',
);
$form['preview']['width'] = array(
'#type' => 'textfield',
'#default_value' => !empty($settings['preview']['width']) ? $settings['preview']['width'] : '',
'#size' => 5,
'#maxlength' => 5,
'#theme_wrappers' => array(),
);
$form['preview']['height'] = array(
'#type' => 'textfield',
'#default_value' => !empty($settings['preview']['height']) ? $settings['preview']['height'] : '',
'#size' => 5,
'#maxlength' => 5,
'#theme_wrappers' => array(),
);
$form['cropbox'] = array(
'#type' => 'container',
'#title' => t('Cropbox size'),
'#theme_wrappers' => array(
'form_element',
),
'#description' => t('Size of cropping box'),
'#markup' => '',
);
$form['cropbox']['width'] = array(
'#type' => 'textfield',
'#default_value' => !empty($settings['cropbox']['width']) ? $settings['cropbox']['width'] : '',
'#size' => 5,
'#maxlength' => 5,
'#theme_wrappers' => array(),
);
$form['cropbox']['height'] = array(
'#type' => 'textfield',
'#default_value' => !empty($settings['cropbox']['height']) ? $settings['cropbox']['height'] : '',
'#size' => 5,
'#maxlength' => 5,
'#theme_wrappers' => array(),
);
return $form;
}