Configure the session language negotiation method for this site.
Expanded class hierarchy of NegotiationSessionForm
class NegotiationSessionForm extends SystemConfigFormBase {
/**
* Implements \Drupal\Core\Form\FormInterface::getFormID().
*/
public function getFormID() {
return 'language_negotiation_configure_session_form';
}
/**
* Implements \Drupal\Core\Form\FormInterface::buildForm().
*/
public function buildForm(array $form, array &$form_state) {
$config = $this->configFactory
->get('language.negotiation');
$form['language_negotiation_session_param'] = array(
'#title' => t('Request/session parameter'),
'#type' => 'textfield',
'#default_value' => $config
->get('session.parameter'),
'#description' => t('Name of the request/session parameter used to determine the desired language.'),
);
$form_state['redirect'] = 'admin/config/regional/language/detection';
return parent::buildForm($form, $form_state);
}
/**
* Implements \Drupal\Core\Form\FormInterface::submitForm().
*/
public function submitForm(array &$form, array &$form_state) {
$this->configFactory
->get('language.settings')
->set('session.parameter', $form_state['values']['language_negotiation_session_param'])
->save();
parent::submitForm($form, $form_state);
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
NegotiationSessionForm:: |
public | function |
Implements \Drupal\Core\Form\FormInterface::buildForm(). Overrides SystemConfigFormBase:: |
|
NegotiationSessionForm:: |
public | function |
Implements \Drupal\Core\Form\FormInterface::getFormID(). Overrides FormInterface:: |
|
NegotiationSessionForm:: |
public | function |
Implements \Drupal\Core\Form\FormInterface::submitForm(). Overrides SystemConfigFormBase:: |
|
SystemConfigFormBase:: |
protected | property | Stores the configuration factory. | |
SystemConfigFormBase:: |
public static | function |
Instantiates a new instance of this controller. Overrides ControllerInterface:: |
9 |
SystemConfigFormBase:: |
public | function |
Implements \Drupal\Core\Form\FormInterface::validateForm(). Overrides FormInterface:: |
7 |
SystemConfigFormBase:: |
public | function | Constructs a \Drupal\system\SystemConfigFormBase object. | 9 |