You are here

function theme_image_import_form in Image 6

Same name and namespace in other branches
  1. 5.2 contrib/image_import/image_import.module \theme_image_import_form()
  2. 5 contrib/image_import/image_import.module \theme_image_import_form()
  3. 7 contrib/image_import/image_import.pages.inc \theme_image_import_form()

Theme function for the image import form.

File

contrib/image_import/image_import.pages.inc, line 169

Code

function theme_image_import_form($form) {
  $output = drupal_render($form['token_help']);
  if (!empty($form['file_list']['#value'])) {
    $type = node_get_types('type', $form['#node_type']);
    $header = array(
      theme('table_select_header_cell'),
      t('Image'),
      t('Name'),
      t('Size'),
      t('Dimensions'),
      check_plain($type->title_label),
      check_plain($type->body_label),
    );
    $rows = array();
    foreach (element_children($form['files']['import']) as $key) {
      $filename = $form['files']['import'][$key]['#title'];
      unset($form['files']['import'][$key]['#title']);
      $row = array(
        array(
          'data' => drupal_render($form['files']['import'][$key]),
        ),
        array(
          'data' => '<img width="40" src="' . url($form['#dirpath'] . '/' . $filename) . '">',
        ),
        array(
          'data' => $filename,
        ),
        array(
          'data' => drupal_render($form['files']['filesize'][$key]),
        ),
        array(
          'data' => drupal_render($form['files']['dimensions'][$key]),
        ),
      );
      if (!isset($form['files']['errors'][$key])) {
        $row[] = array(
          'data' => drupal_render($form['files']['title'][$key]),
        );
        $row[] = array(
          'data' => drupal_render($form['files']['body'][$key]),
        );
      }
      else {
        $row[] = array(
          'colspan' => 2,
          'data' => drupal_render($form['files']['errors'][$key]),
        );
      }
      $rows[] = $row;
    }
    $output .= theme('table', $header, $rows);
  }
  return $output . drupal_render($form);
}