function theme_nodequeue_arrange_subqueue_form in Nodequeue 6.2
Same name and namespace in other branches
- 5.2 nodequeue.module \theme_nodequeue_arrange_subqueue_form()
Theme the subqueue overview as a sortable list.
File
- ./
nodequeue.module, line 2041 - Maintains queues of nodes in arbitrary order.
Code
function theme_nodequeue_arrange_subqueue_form($form) {
$output = '';
$subqueue = $form['#subqueue'];
// Get css to hide some of the help text if javascript is disabled.
drupal_add_css(drupal_get_path('module', 'nodequeue') . '/nodequeue.css');
$table_id = 'nodequeue-dragdrop-' . $subqueue['sqid'];
$table_classes = array(
'nodequeue-dragdrop',
'nodequeue-dragdrop-qid-' . $subqueue['qid'],
'nodequeue-dragdrop-sqid-' . $subqueue['sqid'],
'nodequeue-dragdrop-reference-' . $subqueue['reference'],
);
drupal_add_tabledrag($table_id, 'order', 'sibling', 'node-position');
drupal_add_js(drupal_get_path('module', 'nodequeue') . '/nodequeue_dragdrop.js');
$reverse[str_replace('-', '_', $table_id)] = (bool) $form['#queue']['reverse'];
drupal_add_js(array(
'nodequeue' => array(
'reverse' => $reverse,
),
), 'setting');
// Render form as table rows.
$rows = array();
$counter = 1;
foreach (element_children($form) as $key) {
if (isset($form[$key]['title'])) {
$row = array();
$row[] = drupal_render($form[$key]['title']);
$row[] = drupal_render($form[$key]['author']);
$row[] = drupal_render($form[$key]['date']);
$row[] = drupal_render($form[$key]['position']);
$row[] = !empty($form[$key]['edit']) ? drupal_render($form[$key]['edit']) : ' ';
$row[] = drupal_render($form[$key]['remove']);
$row[] = array(
'data' => $counter,
'class' => 'position',
);
$rows[] = array(
'data' => $row,
'class' => 'draggable',
);
}
$counter++;
}
if (empty($rows)) {
$rows[] = array(
array(
'data' => t('No nodes in this queue.'),
'colspan' => 7,
),
);
}
// Render the main nodequeue table.
$header = array(
t('Title'),
t('Author'),
t('Post Date'),
t('Position'),
array(
'data' => t('Operations'),
'colspan' => 2,
),
t('Position'),
);
$output .= theme('table', $header, $rows, array(
'id' => $table_id,
'class' => implode(' ', $table_classes),
));
// Render the autocomplete field for adding a node to the table.
$output .= '<div class="container-inline">';
$output .= drupal_render($form['add']['nid']);
$output .= drupal_render($form['add']['submit']);
$output .= '</div>';
// Render the remaining form elements.
$output .= drupal_render($form);
return $output;
}