You are here

public function MultiStepFormBase::buildForm in User Merge 2.x

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

2 calls to MultiStepFormBase::buildForm()
PickAccountsForm::buildForm in src/Form/PickAccountsForm.php
Form constructor.
ReviewUserForm::buildForm in src/Form/ReviewUserForm.php
Form constructor.
2 methods override MultiStepFormBase::buildForm()
PickAccountsForm::buildForm in src/Form/PickAccountsForm.php
Form constructor.
ReviewUserForm::buildForm in src/Form/ReviewUserForm.php
Form constructor.

File

src/Form/MultiStepFormBase.php, line 70

Class

MultiStepFormBase
Class MultiStepFormBase.

Namespace

Drupal\usermerge\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['actions']['#type'] = 'actions';
  if ($this->reviewSwitcher
    ->hasPrevious(static::class)) {
    $form['actions']['previous'] = [
      '#type' => 'submit',
      '#value' => $this
        ->t('Go back'),
      '#button_type' => 'primary',
      '#weight' => 10,
      '#submit' => [
        '::submitGoBack',
      ],
    ];
  }
  if ($this->reviewSwitcher
    ->hasNext(static::class)) {
    $form['actions']['next'] = [
      '#type' => 'submit',
      '#value' => $this
        ->t('Continue'),
      '#button_type' => 'primary',
      '#weight' => 10,
      '#submit' => [
        '::submitForm',
        '::submitGoNext',
      ],
    ];
  }
  else {
    $form['actions']['submit'] = [
      '#type' => 'submit',
      '#value' => $this
        ->t('Merge accounts'),
      '#button_type' => 'primary',
      '#weight' => 10,
      '#submit' => [
        '::submitForm',
        '::submitCreateBatch',
      ],
    ];
  }
  return $form;
}