function LanguageConfigurationElement::buildForm

Same name in other branches
  1. 9 core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElement.php \Drupal\language_elements_test\Form\LanguageConfigurationElement::buildForm()
  2. 8.9.x core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElement.php \Drupal\language_elements_test\Form\LanguageConfigurationElement::buildForm()
  3. 11.x core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElement.php \Drupal\language_elements_test\Form\LanguageConfigurationElement::buildForm()

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\Form

Code

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.