popsu-d7/sites/all/modules/addressfield/plugins/format/address-hide-country.inc
Bachir Soussi Chiadmi 1bc61b12ad first import
2015-04-08 11:40:19 +02:00

23 lines
527 B
PHP

<?php
/**
* @file
* Hide then country when only one country is available.
*/
$plugin = array(
'title' => t('Hide the country when only one is available'),
'format callback' => 'addressfield_format_address_hide_country',
'type' => 'address',
'weight' => -80,
);
/**
* Format callback.
*
* @see CALLBACK_addressfield_format_callback()
*/
function addressfield_format_address_hide_country(&$format, $address, $context = array()) {
$format['country']['#access'] = (count($format['country']['#options']) > 1);
}