You are here

function theme_nodesinblock_queue in Nodes In Block 6

Same name and namespace in other branches
  1. 7 nodesinblock.admin.inc \theme_nodesinblock_queue()

Theme queue form.

File

./nodesinblock.admin.inc, line 292
Administration page for nodes in block.

Code

function theme_nodesinblock_queue($form) {
  $output = '';
  $rows = array();
  foreach (element_children($form['nodes']) as $nid) {
    $element =& $form['nodes'][$nid];
    $element['weight']['#attributes']['class'] = 'nodes-weight';
    $row = array();
    $row[] = drupal_render($element['title']);
    $row[] = drupal_render($element['node_status']);
    $row[] = drupal_render($element['visibility']);
    $row[] = drupal_render($element['weight']);
    $row[] = l(t('View'), 'node/' . $nid) . ' - ' . l(t('Edit'), 'node/' . $nid . '/edit', array(
      'query' => drupal_get_destination(),
    ));
    $row = array_merge(array(
      'data' => $row,
    ), array());
    $row['class'] = !empty($row['class']) ? $row['class'] . ' draggable' : 'draggable';
    $rows[] = $row;
  }
  if (isset($form['blocklinks'])) {
    $output .= drupal_render($form['blocklinks']);
  }
  if (isset($form['createlinks'])) {
    $output .= drupal_render($form['createlinks']);
  }
  if ($rows) {
    drupal_add_tabledrag('nodesinblock', 'order', 'sibling', 'nodes-weight');
    $header = array(
      t('Title'),
      t('Node status'),
      t('Visibility'),
      t('Weight'),
      t('Operations'),
    );
    $output .= theme('table', $header, $rows, array(
      'id' => 'nodesinblock',
    ));
    $output .= drupal_render($form);
  }
  else {
    $output .= t('No nodes found.');
  }
  return $output;
}