You are here

public function InviteLinkBlockForm::buildForm in Invite 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

modules/invite_link/src/Form/InviteLinkBlockForm.php, line 26

Class

InviteLinkBlockForm
Class InviteLinkBlockForm.

Namespace

Drupal\invite_link\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form['create_invite'] = [
    '#type' => 'button',
    '#value' => $this
      ->t('Create invite'),
    '#limit_validation_errors' => [
      [
        'create_invite',
      ],
    ],
    '#executes_submit_callback' => TRUE,
    '#ajax' => [
      'callback' => '::ajaxReplaceInviteContainer',
      'wrapper' => 'invite',
      'method' => 'replace',
    ],
  ];
  $form['invite_containter'] = [
    '#type' => 'container',
    '#prefix' => '<div id="invite">',
    '#suffix' => '</div>',
  ];
  return $form;
}