function amazon_settings_form_validate in Amazon Product Advertisement API 7
Same name and namespace in other branches
- 6 amazon.admin.inc \amazon_settings_form_validate()
- 7.2 amazon.admin.inc \amazon_settings_form_validate()
Validate the keys and trim whitespace.
File
- ./
amazon.admin.inc, line 62 - Amazon Admin pages.
Code
function amazon_settings_form_validate($form, &$form_state) {
$form_state['values']['amazon_aws_access_key'] = trim($form_state['values']['amazon_aws_access_key']);
$form_state['values']['amazon_aws_secret_access_key'] = trim($form_state['values']['amazon_aws_secret_access_key']);
// Load locale data
require_once drupal_get_path('module', 'amazon') . '/includes/amazon.locales.inc';
$locales = _amazon_load_locales();
$expire = FALSE;
// Set up default values for each locale to the Drupal Association ID for that locale (if available)
foreach ($locales as $locale => $data) {
$assoc_id = variable_get('amazon_locale_' . $locale . '_associate_id', '');
if ($assoc_id != $form_state['values']['amazon_locale_' . $locale . '_associate_id']) {
$expire = TRUE;
}
}
if ($expire) {
amazon_expire_items();
}
}