You are here

function theme_gallery_edit_images_form in Node Gallery 6.2

Same name and namespace in other branches
  1. 6 node_gallery.themes.inc \theme_gallery_edit_images_form()
1 theme call to theme_gallery_edit_images_form()
node_gallery_edit_images_form in ./node_gallery.pages.inc

File

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

Code

function theme_gallery_edit_images_form($form) {
  drupal_add_tabledrag('upload-attachments', 'order', 'sibling', 'upload-weight');
  $thumb_imagecache = $form['#thumb_imagecache'];
  $header = array(
    '↑↓',
    t('Delete'),
    t('Thumbnail'),
    t('Edit'),
    t('Weight'),
    t('Cover'),
  );
  foreach (element_children($form['files']) as $key) {

    // Add class to group weight fields for drag and drop.
    $form['files'][$key]['weight']['#attributes']['class'] = 'upload-weight';
    $row = array(
      '',
    );
    $row[] = drupal_render($form['files'][$key]['remove']);
    $row[] = '<span class="gallery-upload-thumb">' . theme('imagecache', $thumb_imagecache, $form['files'][$key]['filepath']['#value'], $form['files'][$key]['filename']['#value'], $form['files'][$key]['filename']['#value']) . '</span>';
    $row[] = drupal_render($form['files'][$key]['edit_form']) . drupal_render($form['files'][$key]['gid']);
    $row[] = drupal_render($form['files'][$key]['weight']);
    if ($form['is_cover']) {
      $row[] = drupal_render($form['is_cover'][$key]);
    }
    $rows[] = array(
      'data' => $row,
      'class' => 'draggable',
    );
  }
  $output = theme('table', $header, $rows, array(
    'id' => 'upload-attachments',
  ));
  $output .= drupal_render($form);
  return $output;
}