You are here

function imagecache_actions_pos_form in ImageCache Actions 8

Same name and namespace in other branches
  1. 6.2 utility-form.inc \imagecache_actions_pos_form()
  2. 7 utility-form.inc \imagecache_actions_pos_form()

Prepares a sub form for displaying positioning fields.

Parameters

array $data: Effect data of the effect where this sub form will be integrated.

Return value

array The form definition for this sub form.

4 calls to imagecache_actions_pos_form()
canvasactions_canvas2file_form in canvasactions/canvasactions.inc
Image effect form callback for the underlay (background) effect.
canvasactions_definecanvas_form in canvasactions/canvasactions.inc
Image effect form callback for the define canvas effect.
canvasactions_file2canvas_form in canvasactions/canvasactions.inc
Image effect form callback for the overlay (watermark) effect.
canvasactions_source2canvas_form in canvasactions/canvasactions.inc
Image effect form callback for the overlay: source image to canvas effect.
1 string reference to 'imagecache_actions_pos_form'
canvasactions.inc in canvasactions/canvasactions.inc

File

./utility-form.inc, line 15
Utility form, conversion and rendering functions for image processes.

Code

function imagecache_actions_pos_form(array $data) {
  $defaults = array(
    'xpos' => 'center',
    'ypos' => 'center',
  );
  $data = array_merge($defaults, (array) $data);
  $description1 = t('Enter an offset in pixels (e.g. 10, 10px), a percentage (e.g. 25%), or one of the keywords: <em>left</em>, <em>center</em>, or <em>right</em> wih an optional offset (e.g. center, right - 10%).');
  $description2 = t('Enter an offset in pixels (e.g. 10, 10px), a percentage (e.g. 25%), or one of the keywords: <em>top</em>, <em>center</em>, or <em>bottom</em> wih an optional offset (e.g. center, bottom - 10%).');
  $form = array(
    'xpos' => array(
      '#type' => 'textfield',
      '#title' => t('X offset'),
      '#default_value' => $data['xpos'],
      '#size' => 6,
      '#description' => $description1,
      '#element_validate' => array(
        'imagecache_actions_validate_number',
      ),
    ),
    'ypos' => array(
      '#type' => 'textfield',
      '#title' => t('Y offset'),
      '#default_value' => $data['ypos'],
      '#size' => 6,
      '#description' => $description2,
      '#element_validate' => array(
        'imagecache_actions_validate_number',
      ),
    ),
  );
  return $form;
}