You are here

public static function Amazon::getAccessKey in Amazon Product Advertisement API 8.2

Returns the access key needed for API calls.

Return value

string|bool String on success, FALSE otherwise.

3 calls to Amazon::getAccessKey()
Amazon::__construct in src/Amazon.php
Provides an Amazon object for calling the Amazon API.
SettingsForm::buildForm in src/Form/SettingsForm.php
Form constructor.
SettingsForm::validateForm in src/Form/SettingsForm.php
Form validation handler.

File

src/Amazon.php, line 102
Contains Drupal\amazon\Amazon

Class

Amazon
Provides methods that interfaces with the Amazon Product Advertising API.

Namespace

Drupal\amazon

Code

public static function getAccessKey() {

  // Use credentials from environment variables, if available.
  $key = getenv(self::AMAZON_ACCESS_KEY);
  if ($key) {
    return $key;
  }

  // If not, use Drupal config variables. (Automatically handles overrides
  // in settings.php.)
  $key = \Drupal::config('amazon.settings')
    ->get('access_key');
  if ($key) {
    return $key;
  }
  return FALSE;
}