function theme_tripal_node_toc_items_table

2.x tripal_core.toc.inc theme_tripal_node_toc_items_table($variables)
3.x tripal_core.toc.inc theme_tripal_node_toc_items_table($variables)

Parameters

$variables:

2 theme calls to theme_tripal_node_toc_items_table()

File

tripal_core/includes/tripal_core.toc.inc, line 127

Code

function theme_tripal_node_toc_items_table($variables) {
  $elements = $variables['element'];
  $toc_items = array();

  // Sort the toc_items using a custom sort function. But we need to include
  // only the items we want in the table (exclude renderable stuff).
  foreach (element_children($elements) as $key) {
    $toc_items[] = $elements[$key];
  }
  usort($toc_items, 'theme_tripal_node_sort_toc_items');

  // Build the table header.
  $headers = array('Content Pane Name', 'Hide', 'Weight');

  // Format the form elements as rows in the table.
  $rows = array();
  foreach ($toc_items as $key => $item) {
    $rows[] = array(
      'data' => array(
        drupal_render($item['title']),
        drupal_render($item['hide']),
        drupal_render($item['weight']),
      ),
      'class' => array('draggable'),
    );
  }

  // Theme and return the table.
  $table = array(
    'header' => $headers,
    'rows' => $rows,
    'attributes' => array("id" => 'tripal-node-toc-items-table'),
    'sticky' => TRUE,
    'caption' => t('Content Panes Available in the TOC'),
    'colgroups' => array(),
    'empty' => t('There are no content panes for this page'),
  );
  drupal_add_tabledrag('tripal-node-toc-items-table', 'order', 'sibling', 'tripal-node-toc-items-weights');
  return theme_table($table);
}