You are here

function imagecache_subroutine_form in ImageCache Actions 7

Same name and namespace in other branches
  1. 8 customactions/imagecache_customactions.module \imagecache_subroutine_form()
  2. 6.2 customactions/imagecache_customactions.module \imagecache_subroutine_form()

Image effect form callback for the subroutine effect.

Parameters

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

Return value

array The form definition for this effect.

1 string reference to 'imagecache_subroutine_form'
imagecache_customactions_image_effect_info in customactions/imagecache_customactions.module
Implements hook_image_effect_info().

File

customactions/imagecache_customactions.module, line 221
Allows advanced users to code their own PHP image manipulation routines as part of image style processing.

Code

function imagecache_subroutine_form(array $data) {

  // Add defaults.
  $data += array(
    'subroutine_presetname' => '',
  );

  // List available image styles.
  // The PASS_THROUGH parameter is new as of D7.23, and is added here to prevent
  // image_style_options() from double-encoding the human-readable image style
  // name, since the form API will already sanitize options in a select list.
  $styles = image_style_options(TRUE, PASS_THROUGH);

  //@todo: unset the current style to prevent obvious recursion.
  $form = array();
  $form['subroutine_presetname'] = array(
    '#type' => 'select',
    '#title' => t('Image style to call'),
    '#default_value' => $data['subroutine_presetname'],
    '#options' => $styles,
    '#required' => TRUE,
  );
  return $form;
}