You are here

public function SettingsForm::buildForm in Akamai 8

Same name and namespace in other branches
  1. 8.2 src/Form/SettingsForm.php \Drupal\akamai\Form\SettingsForm::buildForm()

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides ConfigFormBase::buildForm

File

lib/Drupal/akamai/Form/SettingsForm.php, line 28
Contains \Drupal\akamai\Form\SettingsForm.

Class

SettingsForm
Defines a form that configures Akamai settings.

Namespace

Drupal\akamai\Form

Code

public function buildForm(array $form, array &$form_state) {
  $akamai_config = $this->configFactory
    ->get('akamai.settings');
  $form['akamai_wsdl'] = array(
    '#type' => 'textfield',
    '#title' => t('SOAP WSDL'),
    '#default_value' => $akamai_config
      ->get('wsdl'),
    '#description' => t('The URL of the Akamai SOAP call WSDL, e.g. "https://soap.example.com/example.wsdl"'),
  );
  $form['akamai_restapi'] = array(
    '#type' => 'textfield',
    '#title' => t('REST API URL'),
    '#default_value' => $akamai_config
      ->get('restapi'),
    '#description' => t('The URL of the Akamai REST API call e.g. "https://api.ccu.akamai.com/ccu/v2/queues/default"'),
  );
  $form['akamai_restapi_default'] = array(
    '#type' => 'checkbox',
    '#title' => t('Rest API default'),
    '#default_value' => $akamai_config
      ->get('restapi_default'),
    '#description' => t('This option if checked uses Rest API over SOAP'),
  );
  $form['akamai_basepath'] = array(
    '#type' => 'textfield',
    '#title' => t('Base Path'),
    '#default_value' => $akamai_config
      ->get('basepath'),
    '#description' => t('The URL of the base path (fully qualified domain name) of the site.  This will be used as a prefix for all cache clears (Akamai indexs on the full URI). e.g. "http://www.example.com"'),
  );
  $form['akamai_username'] = array(
    '#type' => 'textfield',
    '#title' => t('Cache clearing user'),
    '#default_value' => $akamai_config
      ->get('username'),
    '#description' => t('The user name of the account being used for cache clearing (most likely an email)'),
  );
  $form['akamai_password'] = array(
    '#type' => 'textfield',
    '#title' => t('Cache clearing password'),
    '#default_value' => $akamai_config
      ->get('password'),
    '#description' => t('The password of the cache clearing user'),
  );
  $form['akamai_domain'] = array(
    '#type' => 'select',
    '#title' => t('Domain'),
    '#default_value' => $akamai_config
      ->get('domain'),
    '#options' => array(
      'staging' => t('Staging'),
      'production' => t('Production'),
    ),
    '#description' => t('The Akamai domain to use for cache clearing'),
  );
  $form['akamai_action'] = array(
    '#type' => 'select',
    '#title' => t('Clearing Action Type Default'),
    '#default_value' => $akamai_config
      ->get('action'),
    '#options' => array(
      'remove' => t('Remove'),
      'invalidate' => t('Invalidate'),
    ),
    '#description' => t('The default clearing action.  The options are <em>remove</em> (which removes the item from the Akamai cache) and <em>invalidate</em> (which leaves the item in the cache, but invalidates it so that the origin will be hit on the next request)'),
  );
  $form['akamai_email'] = array(
    '#type' => 'textfield',
    '#title' => t('Email Notification Override'),
    '#default_value' => $akamai_config
      ->get('email'),
    '#description' => t('If this email address is specified all cache clearing requests will send notifications to this address.  If this address is not specified, the email address of the user executing the request will be used.'),
  );
  return parent::buildForm($form, $form_state);
}