You are here

function iek_image_resize_form in Image effect kit 7

Effect configuration form for iek_image_resize.

1 string reference to 'iek_image_resize_form'
iek_image_effect_info in ./iek.module
Implements hook_image_effect_info().

File

./iek.module, line 595
Primarily Drupal hooks and global API functions to manipulate image styles.

Code

function iek_image_resize_form($data) {
  $form['width'] = array(
    '#type' => 'textfield',
    '#title' => t('Width'),
    '#default_value' => isset($data['width']) ? $data['width'] : '',
    '#field_suffix' => ' ' . t('pixels'),
    '#required' => TRUE,
    '#size' => 10,
    '#element_validate' => array(
      'iek_effect_natural_number_validate',
    ),
    '#allow_natural_number' => array(
      'zero',
      'positive',
    ),
  );
  $form['height'] = array(
    '#type' => 'textfield',
    '#title' => t('Height'),
    '#default_value' => isset($data['height']) ? $data['height'] : '',
    '#field_suffix' => ' ' . t('pixels'),
    '#required' => TRUE,
    '#size' => 10,
    '#element_validate' => array(
      'iek_effect_natural_number_validate',
    ),
    '#allow_natural_number' => array(
      'zero',
      'positive',
    ),
  );
  $form['blank_margin'] = array(
    '#id' => 'blank_margin',
    '#type' => 'select',
    '#title' => t('Blank margin'),
    '#default_value' => isset($data['blank_margin']) && $data['blank_margin'] ? 1 : 0,
    '#options' => array(
      1 => t('True'),
      0 => t('False'),
    ),
    '#required' => TRUE,
    '#allow_natural_number' => array(
      'zero',
      'positive',
    ),
  );
  $form['blank_margin_bg_color'] = array(
    '#type' => 'textfield',
    '#title' => t('Blank margin background color'),
    '#default_value' => isset($data['blank_margin_bg_color']) ? $data['blank_margin_bg_color'] : '#FFFFFF',
    '#size' => 10,
    '#maxlength' => 7,
    '#element_validate' => array(
      'iek_image_effect_blank_margin_bg_color_validate',
    ),
    '#allow_natural_number' => array(
      'zero',
      'positive',
    ),
    '#states' => array(
      'visible' => array(
        ':input[id=blank_margin]' => array(
          'value' => 1,
        ),
      ),
    ),
  );
  $form['position'] = array(
    '#id' => 'position',
    '#type' => 'select',
    '#title' => t('Align position'),
    '#default_value' => isset($data['position']) ? $data['position'] : 'middle_center',
    '#options' => array(
      'top_left' => t('Top Left'),
      'top_center' => t('Top Center'),
      'top_right' => t('Top Right'),
      'middle_left' => t('Middle Left'),
      'middle_center' => t('Middle Center'),
      'middle_right' => t('Middle Right'),
      'bottom_left' => t('Bottom Left'),
      'bottom_center' => t('Bottom Center'),
      'bottom_right' => t('Bottom Right'),
      'coordinate' => t('Coordinate'),
    ),
    '#allow_natural_number' => array(
      'zero',
      'positive',
    ),
  );
  $form['x'] = array(
    '#type' => 'textfield',
    '#title' => t('x-axis'),
    '#default_value' => isset($data['x']) ? $data['x'] : '0',
    '#required' => TRUE,
    '#size' => 5,
    '#element_validate' => array(
      'iek_effect_natural_number_validate',
    ),
    '#allow_natural_number' => array(
      'zero',
      'positive',
    ),
    '#states' => array(
      'visible' => array(
        ':input[id=position]' => array(
          'value' => 'coordinate',
        ),
      ),
    ),
  );
  $form['y'] = array(
    '#type' => 'textfield',
    '#title' => t('y-axis'),
    '#default_value' => isset($data['y']) ? $data['y'] : '0',
    '#required' => TRUE,
    '#size' => 5,
    '#element_validate' => array(
      'iek_effect_natural_number_validate',
    ),
    '#allow_natural_number' => array(
      'zero',
      'positive',
    ),
    '#states' => array(
      'visible' => array(
        ':input[id=position]' => array(
          'value' => 'coordinate',
        ),
      ),
    ),
  );
  return $form;
}