You are here

awssdk_ui.module in AWS SDK for PHP 7.4

Same filename and directory in other branches
  1. 7.5 ui/awssdk_ui.module
  2. 7.3 ui/awssdk_ui.module

Provides primary Drupal hook implementations.

@author Heshan Wanigasooriya ("heshan.lk", http://drupal.org/user/199102) @author Jimmy Berry ("boombatower", http://drupal.org/user/214218)

File

ui/awssdk_ui.module
View source
<?php

/**
 * @file
 * Provides primary Drupal hook implementations.
 *
 * @author Heshan Wanigasooriya ("heshan.lk", http://drupal.org/user/199102)
 * @author Jimmy Berry ("boombatower", http://drupal.org/user/214218)
 */

/**
 * Implements hook_menu().
 */
function awssdk_ui_menu() {
  $items = array();
  $items['admin/config/media/awssdk'] = array(
    'title' => 'AWS SDK for PHP',
    'description' => 'Configure the Amazon Web Services SDK settings.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'awssdk_ui_settings_form',
    ),
    'access arguments' => array(
      'access administration pages',
    ),
  );
  return $items;
}

/**
 * Settings form.
 */
function awssdk_ui_settings_form($form, &$form_state) {
  $form['aws_key'] = array(
    '#type' => 'textfield',
    '#title' => t('Amazon Web Services Key'),
    '#default_value' => variable_get('aws_key', ''),
    '#required' => TRUE,
    '#description' => t('Amazon Web Services Key. Found in the AWS Security Credentials. You can also pass this value as the first parameter to a service constructor.'),
  );
  $form['aws_secret_key'] = array(
    '#type' => 'textfield',
    '#title' => t('Amazon Web Services Secret Key'),
    '#default_value' => variable_get('aws_secret_key', ''),
    '#required' => TRUE,
    '#description' => t('Amazon Web Services Secret Key. Found in the AWS Security Credentials. You can also pass this value as the second parameter to a service constructor.'),
  );
  $form['aws_account_id'] = array(
    '#type' => 'textfield',
    '#title' => t('Amazon Account ID without dashes'),
    '#default_value' => variable_get('aws_account_id', ''),
    '#description' => t('Amazon Account ID without dashes. Used for identification with Amazon EC2. Found in the AWS Security Credentials.'),
  );
  $form['aws_canonical_id'] = array(
    '#type' => 'textfield',
    '#title' => t('Your CanonicalUser ID'),
    '#default_value' => variable_get('aws_canonical_id', ''),
    '#description' => t('Your CanonicalUser ID. Used for setting access control settings in AmazonS3. Found in the AWS Security Credentials.'),
  );
  $form['aws_canonical_name'] = array(
    '#type' => 'textfield',
    '#title' => t('Your CanonicalUser DisplayName'),
    '#default_value' => variable_get('aws_canonical_name', ''),
    '#return_value' => TRUE,
    '#description' => t('Your CanonicalUser DisplayName. Used for setting access control settings in AmazonS3. Found in the AWS Security Credentials (i.e. "Welcome, AWS_CANONICAL_NAME").'),
  );
  $form['aws_certificate_authority'] = array(
    '#type' => 'checkbox',
    '#title' => t('Determines which Cerificate Authority file to use'),
    '#default_value' => variable_get('aws_certificate_authority', ''),
    '#description' => t('A value of boolean `false` will use the Certificate Authority file available on the system. A value of boolean `true` will use the Certificate Authority provided by the SDK. Passing a file system path to a Certificate Authority file (chmodded to `0755`) will use that. Leave this set to `false` if you\'re not sure.'),
  );
  $form['aws_default_cache_config'] = array(
    '#type' => 'textarea',
    '#title' => t('Storage type to use for caching'),
    '#default_value' => variable_get('aws_default_cache_config', ''),
    '#description' => t('This option allows you to configure a preferred storage type to use for caching by default. This can be changed later using the set_cache_config() method. Valid values are: `apc`, `xcache`, a DSN-style string such as `pdo.sqlite:/sqlite/cache.db`, a file system path such as `./cache` or `/tmp/cache/`, or a serialized array for memcached configuration.'),
  );
  $form['aws_mfa_serial'] = array(
    '#type' => 'textfield',
    '#title' => t('12-digit serial number'),
    '#default_value' => variable_get('aws_mfa_serial', ''),
    '#description' => t('12-digit serial number taken from the Gemalto device used for Multi-Factor Authentication. Ignore this if you\'re not using MFA.'),
  );
  $form['aws_cloudfront_keypair_id'] = array(
    '#type' => 'textfield',
    '#title' => t('Amazon CloudFront key-pair to use for signing private URLs'),
    '#default_value' => variable_get('aws_cloudfront_keypair_id', ''),
    '#description' => t('Amazon CloudFront key-pair to use for signing private URLs. Found in the AWS Security Credentials. This can be set programmatically with <AmazonCloudFront::set_keypair_id()>.'),
  );
  $form['aws_cloudfront_private_key_pem'] = array(
    '#type' => 'textfield',
    '#title' => t('The contents of the *.pem private key that matches with the CloudFront key-pair ID'),
    '#default_value' => variable_get('aws_cloudfront_private_key_pem', ''),
    '#description' => t('The contents of the *.pem private key that matches with the CloudFront key-pair ID. Found in the AWS Security Credentials. This can be set programmatically with <AmazonCloudFront::set_private_key()>.'),
  );
  $form['aws_enable_extensions'] = array(
    '#type' => 'checkbox',
    '#title' => t('Set the value to true to enable autoloading for classes not prefixed with "Amazon" or "CF"'),
    '#default_value' => variable_get('aws_enable_extensions', ''),
    '#return_value' => TRUE,
    '#description' => t('Set the value to true to enable autoloading for classes not prefixed with "Amazon" or "CF". If enabled, load `sdk.class.php` last to avoid clobbering any other autoloaders.'),
  );
  $form['#submit'][] = 'awssdk_ui_settings_form_submit';
  return system_settings_form($form);
}

/**
 * Clear config cache to new settings take effect.
 */
function awssdk_ui_settings_form_submit($form, &$form_state) {
  cache_clear_all('awssdk_config_load', 'cache');
}

Functions

Namesort descending Description
awssdk_ui_menu Implements hook_menu().
awssdk_ui_settings_form Settings form.
awssdk_ui_settings_form_submit Clear config cache to new settings take effect.