public function NegotiationConfigureForm::buildForm in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/language/src/Form/NegotiationConfigureForm.php \Drupal\language\Form\NegotiationConfigureForm::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
- core/
modules/ language/ src/ Form/ NegotiationConfigureForm.php, line 129 - Contains \Drupal\language\Form\NegotiationConfigureForm.
Class
- NegotiationConfigureForm
- Configure the selected language negotiation method for this site.
Namespace
Drupal\language\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$configurable = $this->languageTypes
->get('configurable');
$form = array(
'#theme' => 'language_negotiation_configure_form',
'#language_types_info' => $this->languageManager
->getDefinedLanguageTypesInfo(),
'#language_negotiation_info' => $this->negotiator
->getNegotiationMethods(),
);
$form['#language_types'] = array();
foreach ($form['#language_types_info'] as $type => $info) {
// Show locked language types only if they are configurable.
if (empty($info['locked']) || in_array($type, $configurable)) {
$form['#language_types'][] = $type;
}
}
foreach ($form['#language_types'] as $type) {
$this
->configureFormTable($form, $type);
}
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#button_type' => 'primary',
'#value' => $this
->t('Save settings'),
);
return $form;
}