Send button appears above message body

dbabbage - March 27, 2009 - 03:23
Project:Send
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

The Send button is appearing above the message body. I'm going to speculate the following at lines 90-92 of send.inc is related:

  // goofy hack to get the buttons at the end of the array :(
  $form['submit']['#weight'] += 1;
  $form['delete']['#weight'] += 1;

Most likely, this "goofy hack" worked in D5 and doesn't in D6.

#1

dbabbage - March 27, 2009 - 08:17

Should anyone else be wanting to fix this, I have replaced theme_send_form with the following:

function theme_send_form(&$form) {
  $from    = drupal_render($form['from']);
  $to      = drupal_render($form['to']);
  $subject = drupal_render($form['subject']);
  $message = drupal_render($form['message']);
  $body    = drupal_render($form['body']);
  $buttons = drupal_render($form['buttons']);
  $template= check_markup(drupal_render($form['template']), $form['template']['template_format']['#value']);
  $extra   = drupal_render($form);

  $headers = theme('table', array(t('From'), t('To')), array(array('data' => array($from, $to), 'valign' => 'top')), array('width' => '100%'));

  return $headers . $extra . '<span class="label">' . t('Subject') . ': </span>' . $subject .'<br class="clear" />'. $message . $buttons . '<br />&nbsp;<br class="clear">' . $body;
}

Previously, the form was unnecessarily combining $message and $body before display, which no doubt is required in the module for later processing but which made no difference to the form submission so did not need to occur here. A few lines of code have been removed that were associated with that. I have also added in a label for the subject, and a span with the class "label" so that it can be styled using CSS. Finally, I changed the positions of some of the break tags to make what I thought was a more sensible default spacing. YMMV.

If it is agreed that the main issue here is a bug I can submit a proper patch at some point.

 
 

Drupal is a registered trademark of Dries Buytaert.