function ContactForm::buildForm
Same name in other branches
- 3.x modules/content_entity_example/src/Form/ContactForm.php \Drupal\content_entity_example\Form\ContactForm::buildForm()
- 8.x-1.x content_entity_example/src/Form/ContactForm.php \Drupal\content_entity_example\Form\ContactForm::buildForm()
Overrides EntityForm::buildForm
File
-
modules/
content_entity_example/ src/ Form/ ContactForm.php, line 19
Class
- ContactForm
- Form controller for the content_entity_example entity edit forms.
Namespace
Drupal\content_entity_example\FormCode
public function buildForm(array $form, FormStateInterface $form_state) {
/** @var \Drupal\content_entity_example\Entity\Contact $entity */
$form = parent::buildForm($form, $form_state);
$entity = $this->entity;
$form['langcode'] = [
'#title' => $this->t('Language'),
'#type' => 'language_select',
'#default_value' => $entity->getUntranslated()
->language()
->getId(),
'#languages' => Language::STATE_ALL,
];
return $form;
}