You are here

function uc_addresses_get_address_fields in Ubercart Addresses 7

Same name and namespace in other branches
  1. 6.2 uc_addresses.module \uc_addresses_get_address_fields()

Returns all fields registered by hook_uc_addresses_fields().

Return value

array A list of all available address field definitions.

10 calls to uc_addresses_get_address_fields()
UcAddressesFieldHandler::checkContext in handlers/UcAddressesFieldHandler.class.php
Checks if the field passes the context.
UcAddressesFieldHandler::__construct in handlers/UcAddressesFieldHandler.class.php
UcAddressesFormField object constructor.
UcAddressesSchemaAddress::getDefinedFields in class/UcAddressesSchemaAddress.class.php
Returns defined fields.
uc_addresses_entity_property_info_alter in ./uc_addresses.module
Implements hook_entity_property_info_alter().
uc_addresses_form_uc_store_address_fields_form_alter in ./uc_addresses.module
Implements hook_form_FORM_ID_alter() for form uc_store_address_fields_form().

... See full list

1 string reference to 'uc_addresses_get_address_fields'
UcAddressesSchemaAddress::getDefinedFields in class/UcAddressesSchemaAddress.class.php
Returns defined fields.

File

./uc_addresses.module, line 1353
Adds user profile address support to Ubercart.

Code

function uc_addresses_get_address_fields() {
  $fields =& drupal_static(__FUNCTION__, array());
  if (count($fields) < 1) {
    ctools_include('plugins');
    ctools_plugin_api_include('uc_addresses', 'uc_addresses_fields', 2, 2);
    $fields = module_invoke_all('uc_addresses_fields');

    // Allow other modules to alter the field definitions.
    drupal_alter('uc_addresses_fields', $fields);
    foreach ($fields as $fieldname => $fielddata) {

      // Add name for the field (never set manually).
      $fields[$fieldname]['name'] = $fieldname;

      // Add default values for properties that are not set.
      $fields[$fieldname] += array(
        'type' => 'text',
        'title' => check_plain($fieldname),
        'description' => '',
        'display_settings' => array(),
        'compare' => TRUE,
        // The hidden setting only applies for the address field settings page.
        'hidden' => FALSE,
      );

      // Add default display settings.
      $fields[$fieldname]['display_settings'] += array(
        'default' => TRUE,
      );

      // Add label if not set. Used by Entity API.
      if (!isset($fields[$fieldname]['label'])) {
        $fields[$fieldname]['label'] = $fields[$fieldname]['title'];
      }
    }
  }
  return $fields;
}