You are here

function canvasactions_resizepercent_form in ImageCache Actions 8

Same name and namespace in other branches
  1. 7 canvasactions/canvasactions.inc \canvasactions_resizepercent_form()

Image effect form callback for the resize percent effect.

Parameters

array $data: The current configuration for this image effect.

Return value

array The form definition for this effect.

1 string reference to 'canvasactions_resizepercent_form'
imagecache_canvasactions_image_effect_info in canvasactions/imagecache_canvasactions.module
Implements hook_image_effect_info().

File

canvasactions/canvasactions.inc, line 968

Code

function canvasactions_resizepercent_form(array $data) {
  $defaults = array(
    'width' => '',
    'height' => '',
  );
  $data = array_merge($defaults, (array) $data);
  $form['#element_validate'] = array(
    'image_effect_scale_validate',
  );
  $form['width'] = array(
    '#type' => 'textfield',
    '#title' => t('Width'),
    '#default_value' => !empty($data['width']) ? (double) $data['width'] : '',
    '#field_suffix' => ' ' . t('percent'),
    '#required' => FALSE,
    '#size' => 10,
    '#element_validate' => array(
      'canvasactions_resizepercent_validate',
    ),
    '#allow_negative' => FALSE,
  );
  $form['height'] = array(
    '#type' => 'textfield',
    '#title' => t('Height'),
    '#default_value' => !empty($data['height']) ? (double) $data['height'] : '',
    '#field_suffix' => ' ' . t('percent'),
    '#required' => FALSE,
    '#size' => 10,
    '#element_validate' => array(
      'canvasactions_resizepercent_validate',
    ),
    '#allow_negative' => FALSE,
  );
  return $form;
}