when editing a node the swfupload field does not have a label

it makes it hard to distinguish the elements of the swfupload field from surrounding fields

CommentFileSizeAuthor
Selection_149.png64.3 KBbatigolix

Comments

kassissieh’s picture

The title attribute is still present in the $form array, so it appears that SWFUpload makes it disappear entirely. However, the prefix attribute is still visible, so you can use hook_form_alter to display a widget title. Note that this is just a workaround. It would be nice to see a proper solution to this issue in SWFUpload module.

/* in a custom module that you create */
function yourmodule_form_alter(&$form, &$form_state, $form_id) {
  if (isset($form['#node']) && isset($form['type']['#value']) && $form_id == $form['type']['#value'] .'_node_form') {
    if (!isset($form['#after_build'])) {
      $form['#after_build'] = array();
    }
    $form['#after_build'][] = '_yourmodule_after_build';
  }
}


function _yourmodule_after_build($form, &$form_state) {
  $form['field_your_photo_gallery_field_name']['#prefix'] =  '<div class="photo-gallery-title">Photo gallery:</div>';
  return $form;
}


/* in your theme */
.photo-gallery-title {
  margin: 20px 0 10px 0;
  padding-bottom: 2px;
  font-weight: bold;
  border-bottom: 3px solid #cccccc;
  width: 385px;
}