You are here

function theme_workflow_cleanup_form in Workflow 7.2

Same name and namespace in other branches
  1. 7 workflow_cleanup/workflow_cleanup.module \theme_workflow_cleanup_form()

Theme the main form.

File

workflow_cleanup/workflow_cleanup.pages.inc, line 82
Contains an Admin page to delete obsolete states and transitions.

Code

function theme_workflow_cleanup_form($variables) {
  $form = $variables['form'];
  $output = '';
  $header = array(
    t('Select'),
    t('State'),
  );
  $rows = array();
  foreach (element_children($form['no_workflow']) as $sid) {
    $rows[] = array(
      drupal_render($form['no_workflow'][$sid]['check']),
      drupal_render($form['no_workflow'][$sid]['name']),
    );
  }
  $output .= '<h3>' . $form['no_workflow']['#title'] . '</h3>';
  $output .= '<div class="description">' . $form['no_workflow']['#description'] . '</div>';
  $output .= theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'empty' => 'All states are fine',
    'attributes' => array(
      'style' => 'width: auto;',
    ),
  ));
  $header[] = t('Workflow');
  $rows = array();
  foreach (element_children($form['inactive']) as $sid) {
    $rows[] = array(
      drupal_render($form['inactive'][$sid]['check']),
      drupal_render($form['inactive'][$sid]['name']),
      drupal_render($form['inactive'][$sid]['wf']),
    );
  }
  $output .= '<h3>' . $form['inactive']['#title'] . '</h3>';
  $output .= '<div class="description">' . $form['inactive']['#description'] . '</div>';
  $output .= theme('table', array(
    'header' => $header,
    'rows' => $rows,
    'empty' => 'All states are fine',
    'attributes' => array(
      'style' => 'width: auto;',
    ),
  ));
  $output .= drupal_render_children($form);
  return $output;
}