Instead of static label for country drop down list, Make label same as field one.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mqanneh’s picture

Title: Make country list label dynamic » Make country label dynamic
FileSize
16.35 KB
mqanneh’s picture

FileSize
885 bytes
mqanneh’s picture

Priority: Normal » Major
Alan D.’s picture

At this late stage, I'd suggest just using a widget form alter to do this. There was something funny with different cardinality here.

https://api.drupal.org/api/drupal/modules!field!field.api.php/function/h...

And this has issues in i18n.

-      '#title' => t('Country'),
+      '#title' => t($element['#title']),

If you only use one:

function hook_field_widget_form_alter(&$element, &$form_state, $context) {
  if ($context['field']['type'] == 'country') {
    $element['iso2']['#title'] = t('XXXXXXXXX);
  }
}

Or if you try this, both singular and multiple value fields, I can consider making the type to be configurable.

  $element['#type'] = variable_get('countries_continent_widget_container_type', 'container');

Then setting this to be an item (i.e. to show the title).

i.e. running this code once

  variable_set('countries_continent_widget_container_type', 'item');
Alan D.’s picture

Category: Bug report » Feature request
Priority: Major » Normal
Status: Needs review » Needs work
mqanneh’s picture

Assigned: mqanneh » Unassigned
Status: Needs work » Needs review

I tested translation the label and it is working 100%.
can u re check the patch? I think it is important to have a dynamic field label instead of static one.

mqanneh’s picture

+1