function adaptive_image_scale_form in Adaptive Image 7
Form structure for the image scale form.
Note that this is not a complete form, it only contains the portion of the form for configuring the scale options. Therefore it does not not need to include metadata about the effect, nor a submit button.
Parameters
$data: The current configuration for this scale effect.
1 string reference to 'adaptive_image_scale_form'
- adaptive_image_image_effect_info in ./
adaptive_image.module - Implements hook_image_effect_info().
File
- ./
adaptive_image.module, line 93 - Adaptive Image - Adaptive images for Drupal
Code
function adaptive_image_scale_form($data) {
$form['resolutions'] = array(
'#type' => 'textfield',
'#title' => t('Resolutions'),
'#default_value' => isset($data['resolutions']) ? $data['resolutions'] : '1382, 992, 768, 480',
'#required' => TRUE,
'#description' => t('The resolution break-points to use (screen widths, in pixels).'),
);
$form['mobile_first'] = array(
'#type' => 'checkbox',
'#title' => t('Mobile first'),
'#default_value' => isset($data['mobile_first']) ? $data['mobile_first'] : TRUE,
'#description' => t("Check this to send the smallest version when the resolution can not be determined."),
);
$resolutions = explode(',', str_replace(' ', '', $form['resolutions']['#default_value']));
$resolution = adaptive_image_resolution($resolutions);
// Provide needed defaults
$form['height'] = array(
'#type' => 'hidden',
'#default_value' => NULL,
);
$form['width'] = array(
'#type' => 'hidden',
'#default_value' => $resolution,
);
$form['upscale'] = array(
'#type' => 'hidden',
'#default_value' => NULL,
);
return $form;
}