function LanguageSelectWidget::formElement
Same name in other branches
- 9 core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/LanguageSelectWidget.php \Drupal\Core\Field\Plugin\Field\FieldWidget\LanguageSelectWidget::formElement()
- 10 core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/LanguageSelectWidget.php \Drupal\Core\Field\Plugin\Field\FieldWidget\LanguageSelectWidget::formElement()
- 11.x core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/LanguageSelectWidget.php \Drupal\Core\Field\Plugin\Field\FieldWidget\LanguageSelectWidget::formElement()
Overrides WidgetInterface::formElement
File
-
core/
lib/ Drupal/ Core/ Field/ Plugin/ Field/ FieldWidget/ LanguageSelectWidget.php, line 26
Class
- LanguageSelectWidget
- Plugin implementation of the 'Language' widget.
Namespace
Drupal\Core\Field\Plugin\Field\FieldWidgetCode
public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
$element['value'] = $element + [
'#type' => 'language_select',
'#default_value' => $items[$delta]->value,
'#languages' => $this->getSetting('include_locked') ? LanguageInterface::STATE_ALL : LanguageInterface::STATE_CONFIGURABLE,
];
return $element;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.