Configure the selected language negotiation method for this site.
Expanded class hierarchy of NegotiationSelectedForm
class NegotiationSelectedForm extends SystemConfigFormBase {
/**
* Implements \Drupal\Core\Form\FormInterface::getFormID().
*/
public function getFormID() {
return 'language_negotiation_configure_selected_form';
}
/**
* Implements \Drupal\Core\Form\FormInterface::buildForm().
*/
public function buildForm(array $form, array &$form_state) {
$config = $this->configFactory
->get('language.negotiation');
$form['selected_langcode'] = array(
'#type' => 'language_select',
'#title' => t('Language'),
'#languages' => Language::STATE_CONFIGURABLE | Language::STATE_SITE_DEFAULT,
'#default_value' => $config
->get('selected_langcode'),
);
return parent::buildForm($form, $form_state);
}
/**
* Implements \Drupal\Core\Form\FormInterface::submitForm().
*/
public function submitForm(array &$form, array &$form_state) {
$this->configFactory
->get('language.negotiation')
->set('selected_langcode', $form_state['values']['selected_langcode'])
->save();
parent::submitForm($form, $form_state);
}
}
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
NegotiationSelectedForm:: |
public | function |
Implements \Drupal\Core\Form\FormInterface::buildForm(). Overrides SystemConfigFormBase:: |
|
NegotiationSelectedForm:: |
public | function |
Implements \Drupal\Core\Form\FormInterface::getFormID(). Overrides FormInterface:: |
|
NegotiationSelectedForm:: |
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 |