You are here

function amazon_settings_form in Amazon Product Advertisement API 7

Same name and namespace in other branches
  1. 6 amazon.admin.inc \amazon_settings_form()
  2. 7.2 amazon.admin.inc \amazon_settings_form()

Basic Amazon settings form.

1 string reference to 'amazon_settings_form'
amazon_menu in ./amazon.module
Implementation of hook_menu. Adds the url path for the Amazon settings page.

File

./amazon.admin.inc, line 10
Amazon Admin pages.

Code

function amazon_settings_form($form, &$form_state) {
  $cache = amazon_data_cache();
  $options = array();
  foreach ($cache['locales'] as $locale => $data) {
    $options[$locale] = $data['name'];
  }
  $form['amazon_default_locale'] = array(
    '#type' => 'select',
    '#title' => t('Default Amazon locale'),
    '#default_value' => variable_get('amazon_default_locale', 'US'),
    '#options' => $options,
    '#description' => t('Amazon.com uses separate product databases and Ecommerce features in different locales; pricing and availability information, as well as product categorization, differs from one locale to the next. Be sure to select the default locale your site will be running in.'),
  );
  $form['associate_setting'] = array(
    '#type' => 'fieldset',
    '#title' => t('Amazon referral settings'),
    '#description' => t('Enter your associate ID for each locale you\'d like to use on your site. Locales left blank will not be available.<br><strong>Note:</strong> By default the Drupal Association\'s ID will populate the field if it\'s available unless you have already specified your own or cleared the value.'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
  );
  foreach ($cache['locales'] as $locale => $data) {
    $form['associate_setting']['amazon_locale_' . $locale . '_associate_id'] = array(
      '#type' => 'textfield',
      '#title' => t(':locale_name associate ID', array(
        ':locale_name' => $data['name'],
      )),
      '#description' => t('Enter your :locale_name associate ID to receive referral bonuses when shoppers purchase Amazon products via your site.', array(
        ':locale_name' => $data['name'],
      )),
      '#default_value' => variable_get('amazon_locale_' . $locale . '_associate_id', $data['da_associate_id']),
    );
  }
  $form['amazon_aws_access_key'] = array(
    '#type' => 'textfield',
    '#title' => t('Amazon AWS Access Key ID'),
    '#description' => t('You must sign up for an Amazon AWS account to use the Product Advertising Service. See !more_info for information and a registration form.', array(
      '!more_info' => l(t('the AWS home page'), 'https://aws-portal.amazon.com/gp/aws/developer/account/index.html?ie=UTF8&action=access-key', array(
        'html' => TRUE,
      )),
    )),
    '#default_value' => variable_get('amazon_aws_access_key', ''),
    '#required' => TRUE,
  );
  $form['amazon_aws_secret_access_key'] = array(
    '#type' => 'textfield',
    '#title' => t('Amazon AWS Secret Access Key'),
    '#description' => t('You must sign up for an Amazon AWS account to use the Product Advertising Service. See !more_info for information and a registration form.', array(
      '!more_info' => l(t('the AWS home page'), 'https://aws-portal.amazon.com/gp/aws/developer/account/index.html?ie=UTF8&action=access-key', array(
        'html' => TRUE,
      )),
    )),
    '#default_value' => variable_get('amazon_aws_secret_access_key', ""),
    '#required' => TRUE,
  );
  return system_settings_form($form);
}