You are here

public function BadgeForm::buildForm in User Badges 8

Form constructor.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Return value

array The form structure.

Overrides EntityForm::buildForm

File

src/Entity/Form/BadgeForm.php, line 25
Contains \Drupal\user_badges\Entity\Form\BadgeForm.

Class

BadgeForm
Form controller for Badge edit forms.

Namespace

Drupal\user_badges\Entity\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {

  /* @var $entity \Drupal\user_badges\Entity\Badge */
  $form = parent::buildForm($form, $form_state);
  $entity = $this->entity;
  $form['langcode'] = array(
    '#title' => $this
      ->t('Language'),
    '#type' => 'language_select',
    '#default_value' => $entity
      ->language()
      ->getId(),
    '#languages' => LanguageInterface::STATE_ALL,
  );
  return $form;
}