You are here

function addressfield_tokens_webform_hints_element_alter in Addressfield Tokens 7

Implements hook_webform_hints_element_alter().

File

./addressfield_tokens.module, line 509
Main components.

Code

function addressfield_tokens_webform_hints_element_alter(&$element, &$required_label) {
  if ($element['#type'] == 'addressfield_container' || $element['#type'] == 'fieldset') {
    $addressfield_tokens_fields_info = addressfield_tokens_field_formatter_info();
    foreach ($addressfield_tokens_fields_info['addressfield_components']['settings']['components'] as $component) {
      if (isset($element[$component])) {
        if (isset($element[$component]['#options'])) {
          $element[$component]['#empty_option'] = '- ' . $element[$component]['#title'] . $required_label . ' -';
        }
        $element[$component]['#attributes']['placeholder'] = $element[$component]['#title'] . $required_label;
        $element[$component]['#title_display'] = 'invisible';
      }
    }
  }
}