The following code can be changed from:

/**
 * Theme the workflow permissions view.
 */
function theme_workflow_permissions($header, $all) {
  $output = '';
  foreach ($all as $role => $value) {
    $output .= '<h3>'. t("%role may do these transitions:", array('%role' => $value['name'])) .'</h3>';
    if (!empty($value['transitions'])) {
      $output .= theme('table', $header, $value['transitions']) . '<p></p>';
    }
    else {
      $output .= '<table><tbody><tr class="even"><td>' . t('None') . '</td><td></tr></tbody></table><p></p>';
    }
  }
  
  return $output;
}

to:

/**
 * Theme the workflow permissions view.
 */
function theme_workflow_permissions($header, $all) {
  $output = '';
  foreach ($all as $role => $value) {
    $rows = array();
    $output .= '<h3>'. t("%role may do these transitions:", array('%role' => $value['name'])) .'</h3>';
    
    if (empty($value['transitions'])) {
      $rows[] = array(array('data' => t('None'), 'colspan' => 2));
    }
    else {
      $rows = $value['transitions'];
    }
    
    $output .= theme('table', $header, $rows) . '<p></p>';
  }
  
  return $output;
}
CommentFileSizeAuthor
#4 Picture 1.png12.35 KBavpaderno

Comments

avpaderno’s picture

This version corrects a little "glitch" in the UI.

/**
* Theme the workflow permissions view.
*/
function theme_workflow_permissions($header, $all) {
  $output = '';
  foreach ($all as $role => $value) {
    $rows = array();
    $output .= '<h3>'. t("%role may do these transitions:", array('%role' => $value['name'])) .'</h3>';
    
    if (empty($value['transitions'])) {
      $rows[] = array(array('data' => t('No transitions are available.'), 'colspan' => 3));
    }
    else {
      $rows = $value['transitions'];
    }
    
    $output .= theme('table', $header, $rows) . '<p></p>';
  }
  
  return $output;
}
jvandyk’s picture

Status: Active » Fixed

Optimization is not a concern on the edit workflow page.

I'm not sure what glitch in the UI you are referring to. Perhaps the fact that the first row of the table showing no transitions is not dark. I have changed the class to "odd" to make this happen. The code above makes "To" and "From" headers above the rows with no transitions, which I find confusing.

avpaderno’s picture

That is how Drupal core modules show a table; if there aren't rows in the table, the table headers are always shown.

avpaderno’s picture

StatusFileSize
new12.35 KB

You can see it in the comments page, like the screenshot shows.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.