It seems that the label that I have configure my addressfield with is not appearing on the widget form. Bellow are a couple lines that I modified in the function addressfield_widget_form() to get the label to appear. I'm not assuming this is a well thought solution (though a fieldset is a nice idea to contain all the elements) but at least it's a start.

Here's the DIFF:

--- a/sites/all/modules/addressfield/addressfield.module
+++ b/sites/all/modules/addressfield/addressfield.module
@@ -173,10 +173,12 @@ function addressfield_field_widget_form(&$form, &$form_state, $field, $instance,
     $country_list = array_intersect_key($country_list, $settings['available_countries']);
   }
 
+       $element['#type'] = 'fieldset';
+       $element['#title']  = t($instance['label']);
   $wrapper_id = drupal_html_class($field_name) . '-addressfield-wrapper';
   $element['#prefix'] = '<div id="' . $wrapper_id . '">';
   $element['#suffix'] = '</div>';

   $element['country'] = array(
     '#type' => 'select',
     '#title' => t('Country'),

Attached are a couple before and after screenshots.

Comments

rszrama’s picture

Agreed, having a fieldset with a label makes sense. I'm not sure if we'll make this a mandatory thing like it is in your patch, though. Will confer w/ Damien, and I'm interested in feedback from anyone else as well.

damien tournoud’s picture

Status: Active » Fixed
StatusFileSize
new983 bytes

Discussed with Ryan and Bohjan and decided to move forward with the fieldset idea. Definitely not the best looking element, but we don't have a lot of alternatives.

Committed the attached patch.

Status: Fixed » Closed (fixed)

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