function theme_weight_node_admin_nodes in Weight 7
Same name and namespace in other branches
- 6 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 - Implements hook_theme_registry_alter().
File
- ./
weight.module, line 123 - This module uses the sticky column of the node table to add weighting to nodes.
Code
function theme_weight_node_admin_nodes($form) {
$weight_node_types = variable_get('weight_node_types', array_flip(node_type_get_names()));
$weight_node_type_names = array();
foreach ($weight_node_types as $type) {
$weight_node_type_names[] = node_type_get_name($type);
}
// 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) {
$one_of_ours = in_array($form['name'][$key]['#value'], $weight_node_type_names);
// Add a weight element by copying and modifying the title element.
$s = weight_node_selector($key);
$form['weight'][$key] = $form['title'][$key];
$form['weight'][$key]['#value'] = $one_of_ours ? $s['selector'] : '';
$form['status'][$key]['#value'] = $s['status'];
$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;
}