LanguageConfigurationElementTest.php

Same filename in this branch
  1. 11.x core/modules/language/tests/src/Functional/LanguageConfigurationElementTest.php
Same filename in other branches
  1. 9 core/modules/language/tests/src/Functional/LanguageConfigurationElementTest.php
  2. 9 core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElementTest.php
  3. 8.9.x core/modules/language/tests/src/Functional/LanguageConfigurationElementTest.php
  4. 8.9.x core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElementTest.php
  5. 10 core/modules/language/tests/src/Functional/LanguageConfigurationElementTest.php
  6. 10 core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElementTest.php

Namespace

Drupal\language_elements_test\Form

File

core/modules/language/tests/language_elements_test/src/Form/LanguageConfigurationElementTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\language_elements_test\Form;

use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;

/**
 * A form containing a language select element.
 *
 * @internal
 */
class LanguageConfigurationElementTest extends FormBase {
    
    /**
     * {@inheritdoc}
     */
    public function getFormId() {
        return 'language_elements_configuration_element_test';
    }
    
    /**
     * {@inheritdoc}
     */
    public function buildForm(array $form, FormStateInterface $form_state) {
        $form['langcode'] = [
            '#title' => t('Language select'),
            '#type' => 'language_select',
            '#default_value' => language_get_default_langcode('entity_test', 'some_bundle'),
        ];
        return $form;
    }
    
    /**
     * {@inheritdoc}
     */
    public function submitForm(array &$form, FormStateInterface $form_state) {
    }

}

Classes

Title Deprecated Summary
LanguageConfigurationElementTest A form containing a language select element.

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