You are here

function node_gallery_form_alter in Node Gallery 6.2

Same name and namespace in other branches
  1. 6.3 node_gallery.module \node_gallery_form_alter()

File

./node_gallery.module, line 240
Node gallery module file

Code

function node_gallery_form_alter(&$form, $form_state, $form_id) {
  if (isset($form['type']) && isset($form['#node']) && $form['type']['#value'] . '_node_form' == $form_id) {

    //this is an image type edit form.
    if (in_array($form['type']['#value'], (array) node_gallery_get_types('image'))) {
      $image = $form['#node'];
      if (!empty($image->filepath)) {
        $config = node_gallery_get_image_parent_gallery_config($image);
        $form['image_preview'] = array(
          '#value' => theme('image_view', $config['image_size']['preview'], $image),
          '#weight' => -10,
        );
      }
    }
  }
}