You are here

function imagecache_rgb_form in ImageCache Actions 6

Same name and namespace in other branches
  1. 8 utility-color.inc \imagecache_rgb_form()
  2. 5.3 utility.inc \imagecache_rgb_form()
  3. 5.2 utility.inc \imagecache_rgb_form()
  4. 6.2 utility-color.inc \imagecache_rgb_form()
  5. 7 utility-color.inc \imagecache_rgb_form()

Prepare a subform for displaying RGB fields

Helper function to render a common element.

Note that any module that re-uses this form also has to declare the theme function in order to ensure it's in the registry.

4 calls to imagecache_rgb_form()
canvasactions_definecanvas_form in ./canvasactions.inc
Implementation of imagecache_hook_form()
imagecache_alpha_form in ./transparency.inc
Implementation of imagecache_hook_form()
imagecache_colorshift_form in ./imagecache_coloractions.module
Implementation of imagecache_hook_form()
textactions_text2canvas_form in ./textactions.inc
Place text on top of the current canvas

File

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

Code

function imagecache_rgb_form($action) {
  if ($action['HEX'] && ($deduced = hex_to_rgb($action['HEX']))) {
    $action = array_merge($action, $deduced);
    $action['HEX'] = ltrim($action['HEX'], '#');

    // With or without # is valid, but trim for consistancy
  }
  $form = array(
    '#theme' => 'imagecacheactions_rgb_form',
  );
  $form['farb'] = array(
    '#weight' => -1,
  );

  // Placeholder to get its weight right
  $form['HEX'] = array(
    '#type' => 'textfield',
    '#title' => t('HEX'),
    '#default_value' => $action['HEX'],
    '#size' => 7,
  );
  return $form;
}