LanguageSelect.php

Same filename in other branches
  1. 8.9.x core/lib/Drupal/Core/Render/Element/LanguageSelect.php
  2. 10 core/lib/Drupal/Core/Render/Element/LanguageSelect.php
  3. 11.x core/lib/Drupal/Core/Render/Element/LanguageSelect.php

Namespace

Drupal\Core\Render\Element

File

core/lib/Drupal/Core/Render/Element/LanguageSelect.php

View source
<?php

namespace Drupal\Core\Render\Element;

use Drupal\Core\Language\LanguageInterface;

/**
 * Provides a form element for selecting a language.
 *
 * This does not render an actual form element, but always returns the value of
 * the default language. It is then extended by Language module via
 * language_element_info_alter() to provide a proper language selector.
 *
 * @see language_element_info_alter()
 *
 * @FormElement("language_select")
 */
class LanguageSelect extends FormElement {
    
    /**
     * {@inheritdoc}
     */
    public function getInfo() {
        return [
            '#input' => TRUE,
            '#default_value' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
        ];
    }

}

Classes

Title Deprecated Summary
LanguageSelect Provides a form element for selecting a language.

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