You are here

function _imagick_preview_form in Imagick 7

Helper function to show a preview image on the effect edit form

2 calls to _imagick_preview_form()
imagick_preview_form_image_effect_form_alter in imagick_preview/imagick_preview.module
Implements hook_form_FORM_ID_alter()
_imagick_preview_update_preview in imagick_preview/imagick_preview.module
Helper function to update the preview image

File

imagick_preview/imagick_preview.module, line 46

Code

function _imagick_preview_form($data, &$setting_form, $style, $effect) {
  $effect['data'] = $data;
  $combined = $style;
  if (isset($effect['ieid'])) {
    $combined['effects'][$effect['ieid']] = $effect;
  }
  else {
    $combined['effects'][] = $effect;
  }
  $style['effects'] = array(
    $effect,
  );

  // If preview setting has been enabled
  $form['preview']['title'] = array(
    '#theme' => 'html_tag',
    '#tag' => 'h4',
    '#value' => t('Preview'),
  );
  $form['preview']['images'] = array(
    '#type' => 'item',
    '#markup' => theme('imagick_style_preview', array(
      'style' => $style,
      'combined' => $combined,
    )),
    '#prefix' => '<div id="image-style-preview">',
    '#suffix' => '</div>',
  );
  $form['settings']['title'] = array(
    '#theme' => 'html_tag',
    '#tag' => 'h4',
    '#value' => t('Effect settings'),
  );
  foreach ($setting_form as $key => &$element) {
    _imagick_preview_add_element_ajax($element);
  }
  $setting_form = array_merge($form, $setting_form);
  return $form;
}