You are here

function theme_weight_node_admin_nodes in Weight 6

Same name and namespace in other branches
  1. 7 weight.module \theme_weight_node_admin_nodes()

Theme node administration overview. Mostly copied from node.admin.inc.

1 string reference to 'theme_weight_node_admin_nodes'
weight_theme_registry_alter in ./weight.module
Implementation of hook_theme_registry_alter().

File

./weight.module, line 113
This module uses the sticky column of the node table to add weighting to nodes.

Code

function theme_weight_node_admin_nodes($form) {

  // If there are rows in this form, then $form['title'] contains a list of
  // the title form elements.
  $has_posts = isset($form['title']) && is_array($form['title']);
  $select_header = $has_posts ? theme('table_select_header_cell') : '';
  $header = array(
    $select_header,
    t('Title'),
    t('Type'),
    t('Author'),
    t('Status'),
  );
  if (isset($form['language'])) {
    $header[] = t('Language');
  }
  $header[] = t('Operations');
  $header[] = t('Weight');
  $output = '';
  $output .= drupal_render($form['options']);
  if ($has_posts) {
    foreach (element_children($form['title']) as $key) {
      $row = array();
      $row[] = drupal_render($form['nodes'][$key]);
      $row[] = drupal_render($form['title'][$key]);
      $row[] = drupal_render($form['name'][$key]);
      $row[] = drupal_render($form['username'][$key]);
      $row[] = drupal_render($form['status'][$key]);
      if (isset($form['language'])) {
        $row[] = drupal_render($form['language'][$key]);
      }
      $row[] = drupal_render($form['operations'][$key]);
      $row[] = drupal_render($form['weight'][$key]);
      $rows[] = $row;
    }
  }
  else {
    $rows[] = array(
      array(
        'data' => t('No posts available.'),
        'colspan' => '6',
      ),
    );
  }
  $output .= theme('table', $header, $rows);
  if ($form['pager']['#value']) {
    $output .= drupal_render($form['pager']);
  }
  $output .= drupal_render($form);
  return $output;
}