Projet

Général

Profil

Révision f066bdb5

Ajouté par Assos Assos il y a plus de 9 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/addressfield/plugins/format/address-hide-country.inc
18 18
 * @see CALLBACK_addressfield_format_callback()
19 19
 */
20 20
function addressfield_format_address_hide_country(&$format, $address, $context = array()) {
21
  // When building the format for a form, we expect the country element to have
22
  // an #options list. If it does, and there is only one option, hide the field
23
  // by setting #access to FALSE.
24
  if ($context['mode'] == 'form') {
21
  // Hide the country element only if the whole field is required, otherwise
22
  // there will always be an additional None option.
23
  if ($context['mode'] == 'form' && $context['instance']['required']) {
25 24
    if (!empty($format['country']['#options']) && count($format['country']['#options']) == 1) {
26 25
      $format['country']['#access'] =  FALSE;
27 26
    }

Formats disponibles : Unified diff