You are here

function commerce_bpc_token_info in Commerce Bulk Product Creation 7.2

Same name and namespace in other branches
  1. 7 commerce_bpc.tokens.inc \commerce_bpc_token_info()

Implements hook_token_info().

1 call to commerce_bpc_token_info()
commerce_bpc_pattern_settings_form in ./commerce_bpc.admin.inc
Form constructor for the commerce_bpc settings pages.

File

./commerce_bpc.tokens.inc, line 9
Token API implementations for Commerce bulk product creation module.

Code

function commerce_bpc_token_info() {
  $token_type = array(
    'name' => t('Bulk Product'),
    'description' => t('Tokens related to bulk products.'),
    'needs-data' => 'bulk_data',
  );
  $default_token_type = array(
    'name' => t('Bulk Product default patterns'),
    'description' => t('Tokens related to bulk product creation default patterns'),
    'needs-data' => 'bulk_data',
  );
  $bulk_product = array();
  foreach (commerce_product_types() as $bundle_name => $info) {
    if (commerce_bpc_valid_product_type($bundle_name)) {
      $bulk_product += commerce_bpc_token_info_by_product_type($bundle_name);
    }
  }
  $default_tokens = array(
    'entered_sku' => array(
      'name' => 'SKU fragment input',
      'description' => 'The SKU fragment entered by the user on the bulk creation form.',
    ),
    'combination_values' => array(
      'name' => 'Combination values',
      'description' => 'The values of the the combination field, joined by the specified separator.',
    ),
    'entered_title' => array(
      'name' => 'Title fragment input',
      'description' => 'The title fragment entered by the user on the bulk creation form.',
    ),
    'combination_labels' => array(
      'name' => 'Combination value labels',
      'description' => 'The labels of the values of the the combination field, joined by the specified separator.',
    ),
  );
  return array(
    'types' => array(
      'bulk_product' => $token_type,
      'bulk_defaults' => $default_token_type,
    ),
    'tokens' => array(
      'bulk_product' => $bulk_product,
      'bulk_defaults' => $default_tokens,
    ),
  );
}