You are here

function theme_diff_node_revisions in Diff 6.2

Same name and namespace in other branches
  1. 5.2 diff.module \theme_diff_node_revisions()
  2. 5 diff.module \theme_diff_node_revisions()
  3. 6 diff.module \theme_diff_node_revisions()
  4. 7.3 diff.theme.inc \theme_diff_node_revisions()
  5. 7.2 diff.theme.inc \theme_diff_node_revisions()

Theme function to display the revisions formular with means to select two revisions.

File

./diff.theme.inc, line 12
Themeable function callbacks for diff.module.

Code

function theme_diff_node_revisions($form) {
  $output = '';

  // Overview table:
  $header = array(
    t('Revision'),
    array(
      'data' => drupal_render($form['submit']),
      'colspan' => 2,
    ),
    array(
      'data' => t('Operations'),
      'colspan' => 2,
    ),
  );
  if (isset($form['info']) && is_array($form['info'])) {
    foreach (element_children($form['info']) as $key) {
      $row = array();
      if (isset($form['operations'][$key][0])) {

        // Note: even if the commands for revert and delete are not permitted,
        // the array is not empty since we set a dummy in this case.
        $row[] = drupal_render($form['info'][$key]);
        $row[] = drupal_render($form['diff']['old'][$key]);
        $row[] = drupal_render($form['diff']['new'][$key]);
        $row[] = drupal_render($form['operations'][$key][0]);
        $row[] = drupal_render($form['operations'][$key][1]);
        $rows[] = $row;
      }
      else {

        // its the current revision (no commands to revert or delete)
        $row[] = array(
          'data' => drupal_render($form['info'][$key]),
          'class' => 'revision-current',
        );
        $row[] = array(
          'data' => drupal_render($form['diff']['old'][$key]),
          'class' => 'revision-current',
        );
        $row[] = array(
          'data' => drupal_render($form['diff']['new'][$key]),
          'class' => 'revision-current',
        );
        $row[] = array(
          'data' => theme('placeholder', t('current revision')),
          'class' => 'revision-current',
          'colspan' => '2',
        );
        $rows[] = array(
          'data' => $row,
          'class' => 'error',
        );
      }
    }
  }
  $output .= theme('table', $header, $rows);
  $output .= drupal_render($form);
  return $output;
}