You are here

function amazon_requirements in Amazon Product Advertisement API 7.2

Same name and namespace in other branches
  1. 6 amazon.install \amazon_requirements()
  2. 7 amazon.install \amazon_requirements()

implementation of hook_requirements to make sure we let them know about the requirement for amazon_aws_secret_access_key

Parameters

$phase:

Return value

A $requirement[] array, or NULL if there are no issues.

File

./amazon.install, line 40
Install, update and uninstall functions for the amazon module.

Code

function amazon_requirements($phase) {
  if ($phase != 'runtime') {
    return;
  }
  $secret_access_key = variable_get('amazon_aws_secret_access_key', "");
  $api_key = variable_get('amazon_aws_access_key', "");
  $associate_tag = amazon_get_associate_id();
  if (empty($secret_access_key) || empty($api_key) || empty($associate_tag)) {
    drupal_set_message(t("The Amazon API must be configured with an Associate Tag, an Access Key ID and an Amazon AWS Secret Access Key to function. Go to !settings.", array(
      "!settings" => l(t("Amazon API Setttings"), 'admin/config/services/amazon'),
    )));
    $requirement['title'] = t("Amazon AWS Settings");
    $requirement['severity'] = REQUIREMENT_WARNING;
    $requirement['value'] = t("Not Set");
    $requirement['description'] = t("The Amazon API must be configured with an Associate Tag, an Access Key ID and an Amazon AWS Secret Access Key to function. Go to !settings.", array(
      "!settings" => l(t("Amazon API Setttings"), 'admin/config/services/amazon'),
    ));
    return array(
      'amazon_aws_secret_access_key' => $requirement,
    );
  }
  return NULL;
}