You are here

function uc_addresses_uc_addresses_fields in Ubercart Addresses 6.2

Same name and namespace in other branches
  1. 7 uc_addresses.uc_addresses_fields.inc \uc_addresses_uc_addresses_fields()

Implementation of hook_uc_addresses_fields().

Register all address fields used by Ubercart Addresses.

Return value

array A list of field definitions.

File

./uc_addresses.uc_addresses_fields.inc, line 135
In this file fields and field handlers for Ubercart Addresses are registered.

Code

function uc_addresses_uc_addresses_fields() {
  $data = array();

  // Display settings for Ubercart Core Fields (except phone).
  $ubercart_display_settings = array(
    'default' => TRUE,
    'address_view' => FALSE,
    'checkout_review' => FALSE,
    'order_view' => FALSE,
  );

  // Ubercart Core Fields.
  $data['first_name'] = array(
    'type' => 'text',
    'description' => t('The addressee\'s first name'),
    'handler' => 'UcAddressesUcTextFieldHandler',
    'display_settings' => $ubercart_display_settings,
  );
  $data['last_name'] = array(
    'type' => 'text',
    'description' => t('The addressee\'s last name'),
    'handler' => 'UcAddressesUcTextFieldHandler',
    'display_settings' => $ubercart_display_settings,
  );
  $data['phone'] = array(
    'type' => 'text',
    'description' => t('The addressee\'s phone number'),
    'handler' => 'UcAddressesUcTextFieldHandler',
  );
  $data['company'] = array(
    'type' => 'text',
    'description' => t('The addressee\'s company name'),
    'handler' => 'UcAddressesUcTextFieldHandler',
    'display_settings' => $ubercart_display_settings,
  );
  $data['street1'] = array(
    'type' => 'text',
    'description' => t('The addressee\'s residence number and street'),
    'handler' => 'UcAddressesUcTextFieldHandler',
    'display_settings' => $ubercart_display_settings,
  );
  $data['street2'] = array(
    'type' => 'text',
    'description' => t('The addressee\'s residence number and street (continued)'),
    'handler' => 'UcAddressesUcTextFieldHandler',
    'display_settings' => $ubercart_display_settings,
  );
  $data['city'] = array(
    'type' => 'text',
    'description' => t('The addressee\'s city of residence'),
    'handler' => 'UcAddressesUcTextFieldHandler',
    'display_settings' => $ubercart_display_settings,
  );
  $data['country'] = array(
    'type' => 'integer',
    'description' => t('The addressee\'s country of residence'),
    'handler' => 'UcAddressesUcCountryFieldHandler',
    'display_settings' => $ubercart_display_settings,
  );
  $data['zone'] = array(
    'type' => 'integer',
    'description' => t('The addressee\'s zone of residence'),
    'handler' => 'UcAddressesUcZoneFieldHandler',
    'display_settings' => $ubercart_display_settings,
  );
  $data['postal_code'] = array(
    'type' => 'text',
    'description' => t('The addressee\'s postal code'),
    'handler' => 'UcAddressesUcTextFieldHandler',
    'display_settings' => $ubercart_display_settings,
  );

  // Ubercart Addresses fields.
  $data['address_name'] = array(
    'title' => t('Address name'),
    'type' => 'text',
    'description' => t('The name used to access this address'),
    'handler' => 'UcAddressesAddressNameFieldHandler',
    'display_settings' => array(
      'default' => TRUE,
      'checkout_form' => FALSE,
      'checkout_review' => FALSE,
      'order_form' => FALSE,
      'order_view' => FALSE,
    ),
    'compare' => FALSE,
  );
  $data['default_shipping'] = array(
    'title' => t('Default shipping address'),
    'type' => 'boolean',
    'description' => t('If the address is the default shipping address'),
    'handler' => 'UcAddressesDefaultAddressFieldHandler',
    'display_settings' => array(
      'default' => TRUE,
      'address_view' => FALSE,
      'checkout_form' => FALSE,
      'checkout_review' => FALSE,
      'order_form' => FALSE,
      'order_view' => FALSE,
    ),
    'compare' => FALSE,
    'suffix' => t('Use as my default shipping address'),
    'default_type' => 'shipping',
  );
  $data['default_billing'] = array(
    'title' => t('Default billing address'),
    'type' => 'boolean',
    'description' => t('If the address is the default billing address'),
    'handler' => 'UcAddressesDefaultAddressFieldHandler',
    'display_settings' => array(
      'default' => TRUE,
      'address_view' => FALSE,
      'checkout_form' => FALSE,
      'checkout_review' => FALSE,
      'order_form' => FALSE,
      'order_view' => FALSE,
    ),
    'compare' => FALSE,
    'suffix' => t('Use as my default billing address'),
    'default_type' => 'billing',
  );

  // Non editable fields.
  $data['aid'] = array(
    'title' => t('Address ID'),
    'type' => 'integer',
    'description' => t('The address ID'),
    'handler' => 'UcAddressesHiddenFieldHandler',
    'display_settings' => array(
      'default' => FALSE,
    ),
    'compare' => FALSE,
  );
  $data['uid'] = array(
    'title' => t('User ID'),
    'type' => 'user',
    'description' => t('The ID of the user who owns this address'),
    'handler' => 'UcAddressesHiddenFieldHandler',
    'display_settings' => array(
      'default' => FALSE,
    ),
    'compare' => FALSE,
  );
  $data['created'] = array(
    'title' => t('Created'),
    'type' => 'date',
    'description' => t('The date this address was created'),
    'handler' => 'UcAddressesDateFieldHandler',
    'display_settings' => array(
      'default' => FALSE,
    ),
    'compare' => FALSE,
  );
  $data['modified'] = array(
    'title' => t('Modified'),
    'type' => 'date',
    'description' => t('The date this address was last modified'),
    'handler' => 'UcAddressesDateFieldHandler',
    'display_settings' => array(
      'default' => FALSE,
    ),
    'compare' => FALSE,
  );
  return $data;
}