address-hide-country.inc 527 B

12345678910111213141516171819202122
  1. <?php
  2. /**
  3. * @file
  4. * Hide then country when only one country is available.
  5. */
  6. $plugin = array(
  7. 'title' => t('Hide the country when only one is available'),
  8. 'format callback' => 'addressfield_format_address_hide_country',
  9. 'type' => 'address',
  10. 'weight' => -80,
  11. );
  12. /**
  13. * Format callback.
  14. *
  15. * @see CALLBACK_addressfield_format_callback()
  16. */
  17. function addressfield_format_address_hide_country(&$format, $address, $context = array()) {
  18. $format['country']['#access'] = (count($format['country']['#options']) > 1);
  19. }