You are here

function theme_nodesinblock_queue in Nodes In Block 7

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

Theme queue form.

File

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

Code

function theme_nodesinblock_queue($variables) {
  $output = '';
  $rows = array();
  $form = $variables['form'];
  foreach (element_children($form['nodes']) as $nid) {
    $element =& $form['nodes'][$nid];
    $element['weight']['#attributes']['class'] = array(
      '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'][] = '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', array(
      'header' => $header,
      'rows' => $rows,
      'attributes' => array(
        'id' => 'nodesinblock',
      ),
    ));
    $output .= drupal_render_children($form);
  }
  else {
    $output .= t('No nodes found.');
  }
  return $output;
}