class SettingsForm in Akamai 8
Same name and namespace in other branches
- 8.2 src/Form/SettingsForm.php \Drupal\akamai\Form\SettingsForm
Defines a form that configures Akamai settings.
Hierarchy
- class \Drupal\Core\Form\FormBase implements ContainerInjectionInterface, FormInterface uses DependencySerializationTrait, LoggerChannelTrait, MessengerTrait, LinkGeneratorTrait, RedirectDestinationTrait, UrlGeneratorTrait, StringTranslationTrait
- class \Drupal\Core\Form\ConfigFormBase uses ConfigFormBaseTrait
- class \Drupal\akamai\Form\SettingsForm
- class \Drupal\Core\Form\ConfigFormBase uses ConfigFormBaseTrait
Expanded class hierarchy of SettingsForm
1 string reference to 'SettingsForm'
File
- lib/
Drupal/ akamai/ Form/ SettingsForm.php, line 16 - Contains \Drupal\akamai\Form\SettingsForm.
Namespace
Drupal\akamai\FormView source
class SettingsForm extends ConfigFormBase {
/**
* {@inheritdoc}
*/
public function getFormID() {
return 'akamai_admin_settings_form';
}
/**
* {@inheritdoc}
*/
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);
}
/**
* {@inheritdoc}
*/
public function validateForm(array &$form, array &$form_state) {
parent::validateForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, array &$form_state) {
$this->configFactory
->get('akamai.settings')
->set('wsdl', $form_state['values']['akamai_wsdl'])
->set('restapi', $form_state['values']['akamai_restapi'])
->set('restapi_default', $form_state['values']['akamai_restapi_default'])
->set('basepath', $form_state['values']['akamai_basepath'])
->set('username', $form_state['values']['akamai_username'])
->set('password', $form_state['values']['akamai_password'])
->set('domain', $form_state['values']['akamai_domain'])
->set('action', $form_state['values']['akamai_action'])
->set('email', $form_state['values']['akamai_email'])
->save();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigFormBase:: |
public static | function |
Instantiates a new instance of this class. Overrides FormBase:: |
13 |
ConfigFormBase:: |
public | function | Constructs a \Drupal\system\ConfigFormBase object. | 11 |
ConfigFormBaseTrait:: |
protected | function | Retrieves a configuration object. | |
ConfigFormBaseTrait:: |
abstract protected | function | Gets the configuration names that will be editable. | 32 |
DependencySerializationTrait:: |
protected | property | An array of entity type IDs keyed by the property name of their storages. | |
DependencySerializationTrait:: |
protected | property | An array of service IDs keyed by property name used for serialization. | |
DependencySerializationTrait:: |
public | function | 1 | |
DependencySerializationTrait:: |
public | function | 2 | |
FormBase:: |
protected | property | The config factory. | 1 |
FormBase:: |
protected | property | The request stack. | 1 |
FormBase:: |
protected | property | The route match. | |
FormBase:: |
protected | function | Gets the config factory for this form. | 1 |
FormBase:: |
private | function | Returns the service container. | |
FormBase:: |
protected | function | Gets the current user. | |
FormBase:: |
protected | function | Gets the request object. | |
FormBase:: |
protected | function | Gets the route match. | |
FormBase:: |
protected | function | Gets the logger for a specific channel. | |
FormBase:: |
protected | function |
Returns a redirect response object for the specified route. Overrides UrlGeneratorTrait:: |
|
FormBase:: |
public | function | Resets the configuration factory. | |
FormBase:: |
public | function | Sets the config factory for this form. | |
FormBase:: |
public | function | Sets the request stack object to use. | |
FormInterface:: |
public | function | Returns a unique string identifying the form. | 236 |
LinkGeneratorTrait:: |
protected | property | The link generator. | 1 |
LinkGeneratorTrait:: |
protected | function | Returns the link generator. | |
LinkGeneratorTrait:: |
protected | function | Renders a link to a route given a route name and its parameters. | |
LinkGeneratorTrait:: |
public | function | Sets the link generator service. | |
LoggerChannelTrait:: |
protected | property | The logger channel factory service. | |
LoggerChannelTrait:: |
protected | function | Gets the logger for a specific channel. | |
LoggerChannelTrait:: |
public | function | Injects the logger channel factory. | |
MessengerTrait:: |
protected | property | The messenger. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
RedirectDestinationTrait:: |
protected | property | The redirect destination service. | 1 |
RedirectDestinationTrait:: |
protected | function | Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url. | |
RedirectDestinationTrait:: |
protected | function | Returns the redirect destination service. | |
RedirectDestinationTrait:: |
public | function | Sets the redirect destination service. | |
SettingsForm:: |
public | function |
Form constructor. Overrides ConfigFormBase:: |
|
SettingsForm:: |
public | function | ||
SettingsForm:: |
public | function |
Form submission handler. Overrides ConfigFormBase:: |
|
SettingsForm:: |
public | function |
Form validation handler. Overrides FormBase:: |
|
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. | |
UrlGeneratorTrait:: |
protected | property | The url generator. | |
UrlGeneratorTrait:: |
protected | function | Returns the URL generator service. | |
UrlGeneratorTrait:: |
public | function | Sets the URL generator service. | |
UrlGeneratorTrait:: |
protected | function | Generates a URL or path for a specific route based on the given parameters. |