You are here

function commerce_customer_token_info in Commerce Core 7

Implements hook_token_info().

File

modules/customer/commerce_customer.tokens.inc, line 12
Builds placeholder replacement tokens for customer related data.

Code

function commerce_customer_token_info() {
  $type = array(
    'name' => t('Customer profiles'),
    'description' => t('Tokens related to customer profiles.'),
    'needs-data' => 'commerce-customer-profile',
  );

  // Tokens for customer profiles.
  $profile = array();
  $profile['customer-profile-id'] = array(
    'name' => t('Customer profile ID'),
    'description' => t('The unique numeric ID of the customer profile.'),
  );
  $profile['revision-id'] = array(
    'name' => t('Revision ID'),
    'description' => t("The unique ID of the customer profile's latest revision."),
  );
  $profile['type'] = array(
    'name' => t('Customer profile type'),
    'description' => t('The type of the customer profile.'),
  );
  $profile['type-name'] = array(
    'name' => t('Customer profile type name'),
    'description' => t('The type name of the customer profile.'),
  );

  // Chained tokens for customer profiles.
  $profile['owner'] = array(
    'name' => t('Customer profile owner'),
    'description' => t('The user the customer profile belongs to.'),
    'type' => 'user',
  );
  $profile['created'] = array(
    'name' => t('Date created'),
    'description' => t('The date the customer profile was created.'),
    'type' => 'date',
  );
  $profile['changed'] = array(
    'name' => t('Date updated'),
    'description' => t('The date the customer profile was last updated.'),
    'type' => 'date',
  );
  return array(
    'types' => array(
      'commerce-customer-profile' => $type,
    ),
    'tokens' => array(
      'commerce-customer-profile' => $profile,
    ),
  );
}