You are here

function iek_image_watermark_form in Image effect kit 7

Effect configuration form for iek_image_watermark.

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

File

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

Code

function iek_image_watermark_form($data) {
  $iek_fonts = iek_get_watermark_fonts();
  $fonts = array();
  foreach ($iek_fonts as $item) {
    $fonts[$item['name']] = $item['title'];
  }
  $form['text'] = array(
    '#type' => 'textfield',
    '#title' => t('Text'),
    '#default_value' => isset($data['text']) ? $data['text'] : '',
    '#required' => TRUE,
    '#size' => 64,
    '#maxlength' => 256,
    '#allow_natural_number' => array(
      'zero',
      'positive',
    ),
    '#description' => t('Available tokens are: !tokens.', array(
      '!tokens' => '[site:mail], [site:login-url], [site:name], [site:slogan], [site:url], [site:url-brief]',
    )),
  );
  $form['font'] = array(
    '#type' => 'select',
    '#options' => $fonts,
    '#title' => t('Font'),
    '#default_value' => isset($data['font']) ? $data['font'] : '',
    '#required' => TRUE,
    '#allow_natural_number' => array(
      'zero',
      'positive',
    ),
  );
  $form['color'] = array(
    '#type' => 'textfield',
    '#title' => t('Text color'),
    '#default_value' => isset($data['color']) ? $data['color'] : '#ffffff',
    '#required' => TRUE,
    '#size' => 10,
    '#maxlength' => 7,
    '#element_validate' => array(
      'iek_image_effect_color_validate',
    ),
    '#allow_natural_number' => array(
      'zero',
      'positive',
    ),
  );
  $form['size'] = array(
    '#type' => 'textfield',
    '#title' => t('Size'),
    '#default_value' => isset($data['size']) ? $data['size'] : '24',
    '#field_suffix' => ' ' . t('pixels'),
    '#required' => TRUE,
    '#size' => 5,
    '#element_validate' => array(
      'iek_effect_natural_number_validate',
    ),
    '#allow_natural_number' => array(
      'zero',
      'positive',
    ),
  );
  $form['angle'] = array(
    '#type' => 'textfield',
    '#title' => t('Angle'),
    '#default_value' => isset($data['angle']) ? $data['angle'] : '-45',
    '#required' => TRUE,
    '#size' => 5,
    '#element_validate' => array(
      'iek_effect_natural_number_validate',
    ),
    '#allow_natural_number' => array(
      'negative',
      'zero',
      'positive',
    ),
    '#description' => t('The angle of watermark. e.g. 45, 0, or -45'),
  );
  $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'),
    ),
    '#allow_natural_number' => array(
      'zero',
      'positive',
    ),
  );
  $form['padding_top'] = array(
    '#type' => 'textfield',
    '#title' => t('Padding top'),
    '#default_value' => isset($data['padding_top']) ? $data['padding_top'] : '10',
    '#field_suffix' => ' ' . t('pixels'),
    '#required' => TRUE,
    '#size' => 5,
    '#element_validate' => array(
      'iek_effect_natural_number_validate',
    ),
    '#allow_natural_number' => array(
      'zero',
      'positive',
    ),
  );
  $form['padding_right'] = array(
    '#type' => 'textfield',
    '#title' => t('Padding right'),
    '#default_value' => isset($data['padding_right']) ? $data['padding_right'] : '10',
    '#field_suffix' => ' ' . t('pixels'),
    '#required' => TRUE,
    '#size' => 5,
    '#element_validate' => array(
      'iek_effect_natural_number_validate',
    ),
    '#allow_natural_number' => array(
      'zero',
      'positive',
    ),
  );
  $form['padding_bottom'] = array(
    '#type' => 'textfield',
    '#title' => t('Padding bottom'),
    '#default_value' => isset($data['padding_bottom']) ? $data['padding_bottom'] : '10',
    '#field_suffix' => ' ' . t('pixels'),
    '#required' => TRUE,
    '#size' => 5,
    '#element_validate' => array(
      'iek_effect_natural_number_validate',
    ),
    '#allow_natural_number' => array(
      'zero',
      'positive',
    ),
  );
  $form['padding_left'] = array(
    '#type' => 'textfield',
    '#title' => t('Padding left'),
    '#default_value' => isset($data['padding_left']) ? $data['padding_left'] : '10',
    '#field_suffix' => ' ' . t('pixels'),
    '#required' => TRUE,
    '#size' => 5,
    '#element_validate' => array(
      'iek_effect_natural_number_validate',
    ),
    '#allow_natural_number' => array(
      'zero',
      'positive',
    ),
  );
  return $form;
}