public function LanguageConfigurationElement::buildForm in Drupal 9
Same name and namespace in other branches
- 8 core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElement.php \Drupal\language_elements_test\Form\LanguageConfigurationElement::buildForm()
- 10 core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElement.php \Drupal\language_elements_test\Form\LanguageConfigurationElement::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 FormInterface::buildForm
File
- core/
modules/ language/ tests/ language_elements_test/ src/ Form/ LanguageConfigurationElement.php, line 26
Class
- LanguageConfigurationElement
- A form containing a language configuration element.
Namespace
Drupal\language_elements_test\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
$conf = ContentLanguageSettings::loadByEntityTypeBundle('entity_test', 'some_bundle');
$form['lang_configuration'] = [
'#type' => 'language_configuration',
'#entity_information' => [
'entity_type' => 'entity_test',
'bundle' => 'some_bundle',
],
'#default_value' => $conf,
];
$form['submit'] = [
'#type' => 'submit',
'#value' => 'Save',
];
$form['#submit'][] = 'language_configuration_element_submit';
return $form;
}