[development] Strange D6 form issue

Nancy Wichmann nan_wich at bellsouth.net
Thu Aug 27 01:41:22 UTC 2009


Here's a strange new issue. This code is identical between D5 and D6, but in
D6 it acts weird.

function revision_deletion_list_form($form_state, $node) {

...

$form['select'][$vid] = array(

'#type' => 'checkbox',

'#disabled' => ($vid == $rev->current),

'#default_value' => $rev->select,

'#return_value' => array(

'action' => 'delete',

'vid' => $vid,

'nid' => $rev->nid,

'title' => $rev->title,

'type' => $rev->type,

),

);

$form['class'][$vid] = array('#type' => 'value', '#value' => $rev->class);

$form['vid'][$vid] = array('#value' => l($vid, 'node/'. $nid .'/revisions/'.
$vid .'/view'));

$form['user'][$vid] = array('#value' => $accounts[$rev->uid]);

...

}

function theme_revision_deletion_list_form($form) {

$eo = array('odd' => 'even', 'even' => 'odd');

...

foreach (element_children($form['vid']) as $key) {

$class = $eo[$class];

$row_class = $class;

if (isset($form['class'][$key])) {

$row_class .= ' '. $form['class'][$key]['#value'];

unset($form['class'][$key]);

}

$log_present = !empty($form['log'][$key]['#value']);

$output .= '<tr class="'. $row_class . ($log_present ? ' merge-down' : NULL)
.'">';

$output .= '<td align="center"'. ($form['select'][$key]['#default_value'] ?
' class="selected"' : '') .'">'. drupal_render($form['select'][$key])
.'</td>';

$output .= '<td>'. drupal_render($form['vid'][$key]) .'</td>';

$output .= '<td>'. drupal_render($form['user'][$key]) .'</td>';

...

}

In D5, the array comes back just fine. In D6, the $row_class becomes the
returned value, unless I comment that line out, in which case, the correct
array is returned.



Nancy E. Wichmann, PMP
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King,
Jr.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.drupal.org/pipermail/development/attachments/20090826/5dc735d0/attachment.htm>


More information about the development mailing list