You are here

function theme_node_gallery_manage_images_form in Node Gallery 6.3

@file Node gallery theme functions

1 theme call to theme_node_gallery_manage_images_form()
node_gallery_manage_images_form in ./node_gallery.pages.inc
Displays the content for our "Manage Images" tab, which is a VBO view.

File

theme/theme.inc, line 8
Node gallery theme functions

Code

function theme_node_gallery_manage_images_form($form) {

  // Pull in the multi-select functionality from core
  drupal_add_js('misc/tableselect.js');

  // get fieldname to retrieve the filepath for the thumbnail without loading the node
  $relationship = node_gallery_get_relationship($form['#gallery']->type);
  $enable_rotation = FALSE;
  if ($relationship['settings']['manage_images_enable_rotation'] && (imageapi_default_toolkit() != 'imageapi_gd' || function_exists("imagerotate"))) {
    $enable_rotation = TRUE;
    if (module_exists('jquery_ui')) {
      drupal_add_css(drupal_get_path('module', 'jquery_ui') . '/jquery.ui/themes/default/ui.all.css');
      jquery_ui_add(array(
        'ui.dialog',
        'ui.draggable',
        'ui.resizable',
      ));
    }
    drupal_add_js(drupal_get_path('module', 'node_gallery') . '/js/ng_manage_images.js');
  }
  $field_name = $relationship['imagefield_name'];
  $thumb_imagecache = $form['#thumb_imagecache'];
  $header = array(
    array(
      'data' => t('Delete'),
      'class' => 'select-all',
    ),
    t('Preview'),
    t('Edit'),
    t('Cover'),
  );
  if ($enable_rotation) {
    $header = array(
      array(
        'data' => t('Delete'),
        'class' => 'select-all',
      ),
      t('Preview'),
      t('Edit'),
      t('Rotation'),
      t('Cover'),
    );
  }
  foreach (element_children($form['images']) as $nid) {
    $element =& $form['images'][$nid];
    $filepath = node_gallery_get_image_filepath($element['edit_form']['nid']['#value'], $field_name);
    $row = array();
    $row[] = drupal_render($element['remove']);
    $row[] = '<span>' . l(theme('imagecache', 'node-gallery-admin-thumbnail', $filepath), 'node/' . $nid . '/edit', array(
      'html' => TRUE,
    )) . '</span>';
    $edit = drupal_render($element['edit_form']);
    if (!empty($element['gid'])) {
      $edit .= drupal_render($element['gid']);
    }
    $row[] = $edit;
    if ($enable_rotation) {
      $row[] = drupal_render($element['rotate']);
    }
    if ($form['is_cover']) {
      $row[] = drupal_render($form['is_cover'][$nid]);
    }
    $rows[] = array(
      'data' => $row,
    );
  }
  $output = theme('table', $header, $rows, array(
    'id' => 'upload-attachments',
  ));
  $output .= drupal_render($form);
  return $output;
}