You are here

function _imagick_preview_add_element_ajax in Imagick 7

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

1 call to _imagick_preview_add_element_ajax()
_imagick_preview_form in imagick_preview/imagick_preview.module
Helper function to show a preview image on the effect edit form

File

imagick_preview/imagick_preview.module, line 94

Code

function _imagick_preview_add_element_ajax(&$element) {
  if (is_array($element) && isset($element['#type'])) {
    if ($element['#type'] == 'fieldset') {
      $children = element_children($element);
      foreach ($element as $key => &$child) {
        if (in_array($key, $children)) {
          _imagick_preview_add_element_ajax($child);
        }
      }
    }
    else {
      $element['#ajax'] = array(
        'callback' => '_imagick_preview_update_preview',
        'wrapper' => 'image-style-preview',
        'method' => 'replace',
      );
    }
  }
}