You are here

public function DummyForm::buildForm in Button Field 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 FormInterface::buildForm

File

src/Form/DummyForm.php, line 23
Contains Drupal\button_field\Form\DummyForm.

Class

DummyForm

Namespace

Drupal\button_field\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $element = $form_state
    ->getBuildInfo()['args'][0];
  $langcode = $element['#entity']
    ->language()
    ->getId();
  $form[$element['#field_name']][$langcode] = $element;
  return $form;
}