You are here

function theme_workflow_history_table in Workflow 7.2

Same name and namespace in other branches
  1. 5.2 workflow.module \theme_workflow_history_table()
  2. 6.2 workflow.pages.inc \theme_workflow_history_table()
  3. 6 workflow.pages.inc \theme_workflow_history_table()
  4. 7 workflow.pages.inc \theme_workflow_history_table()

Theme entire workflow history table.

1 theme call to theme_workflow_history_table()
workflow_tab_page in ./workflow.pages.inc
Menu callback. Display workflow summary of a node.

File

./workflow.pages.inc, line 195
Provide user interface for changing workflow state.

Code

function theme_workflow_history_table($variables) {
  $header = $variables['header'];
  $rows = $variables['rows'];
  $footer = $variables['footer'];
  $entity = $variables['entity'];
  $entity_type = $variables['entity_type'];
  $column_field_name = 1;
  $column_operations = 6;

  // Remove the Operations column if none are added.
  $empty = TRUE;
  foreach ($rows as $row) {
    $empty &= empty($row['data'][$column_operations]);
  }
  if ($empty) {
    foreach ($rows as &$row) {
      unset($row['data'][$column_operations]);
      unset($header[$column_operations]);
    }
  }

  // Remove the Field name column if only 1 workflow_field exists.
  if (count(_workflow_info_fields($entity, $entity_type)) < 2) {
    foreach ($rows as &$row) {
      unset($row['data'][$column_field_name]);
      unset($header[$column_field_name]);
    }
  }
  $output = theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'caption' => t('Workflow History'),
  ));
  if ($footer) {
    $output .= MARK_STATE_IS_DELETED . ' ' . t('State is no longer available.');
  }
  return $output;
}