I have a client who includes very long comments in the workflow comment field. They also have a fixed width theme when node/NNN/workflow is shown. And the result is unnacceptable to them. So I needed to change the way the table is displayed. I had to patch workflow to make it possible.
The patch is attached, and for those who are curious this is how I theme it (gives the comment it's own row in the table, rather than just a cell):
/**
* Override theming of workflow history.
*
* This table appears on the workflow tab of all content. We change
* it because our workflow comments can be quite long, we give them an
* entire row, rather than just a table cell.
*/
function medemcom_workflow_history($result, $states) {
$rows = array();
while ($history = db_fetch_object($result)) {
$rows[] = array(
format_date($history->stamp),
check_plain($states[$history->old_sid]),
check_plain($states[$history->sid]),
theme('username', $history),
);
// Now give the comment its own row.
if ($history->comment)
$rows[] = array('data' => array(array('data' => check_markup($history->comment),
'colspan' => 4,
),
),
'class' => 'workflow_comment',
);
}
$output .= theme('table', array(t('Date'), t('Old State'), t('New State'), t('By')), $rows, array('class' => 'workflow_history', 'id' => 'workflow_history'), t('Workflow History'));
return $output;
}
This work sponsored by http://www.medem.com.
| Comment | File | Size | Author |
|---|---|---|---|
| workflow_theme_history.diff | 1.15 KB | Dave Cohen |
Comments
Comment #1
JacobSingh commentedI'd do this differently, db result objects shouldn't be passed to theme functions. Perhaps you should just build the array of rows and pass that in. Anyway, looping the array twice is quite cheap, so need to do your reformatting as you grab from mysql.
Best,
J
Comment #2
Bastlynn commentedHi,
With the release of Drupal 7, Drupal 5 is no longer receiving security updates, reviews, or development from many contributed modules. Since 5 is now considered a depreciated version, you really should seriously look into upgrading to Drupal 6 or 7. The newer versions of Drupal work better, have more support, and will be safer (literally! security patches!) for your website. We are currently working on a new release for Workflow to Drupal 7. In light of that, further support for Drupal 5 issues is infeasible at the moment. Please consider upgrading to Drupal 6 or 7 in the near future - you'll be glad you did.
- Bastlynn