You are here

public function EnrollInviteUserForm::buildForm in Open Social 10.3.x

Same name and namespace in other branches
  1. 8.9 modules/social_features/social_event/modules/social_event_invite/src/Form/EnrollInviteUserForm.php \Drupal\social_event_invite\Form\EnrollInviteUserForm::buildForm()
  2. 10.0.x modules/social_features/social_event/modules/social_event_invite/src/Form/EnrollInviteUserForm.php \Drupal\social_event_invite\Form\EnrollInviteUserForm::buildForm()
  3. 10.1.x modules/social_features/social_event/modules/social_event_invite/src/Form/EnrollInviteUserForm.php \Drupal\social_event_invite\Form\EnrollInviteUserForm::buildForm()
  4. 10.2.x modules/social_features/social_event/modules/social_event_invite/src/Form/EnrollInviteUserForm.php \Drupal\social_event_invite\Form\EnrollInviteUserForm::buildForm()

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 InviteUserBaseForm::buildForm

File

modules/social_features/social_event/modules/social_event_invite/src/Form/EnrollInviteUserForm.php, line 66

Class

EnrollInviteUserForm
Class EnrollInviteForm.

Namespace

Drupal\social_event_invite\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  $form = parent::buildForm($form, $form_state);
  $nid = $this->routeMatch
    ->getRawParameter('node');
  $form['event'] = [
    '#type' => 'hidden',
    '#value' => $nid,
  ];
  $form['name'] = [
    '#type' => 'social_enrollment_entity_autocomplete',
    '#selection_handler' => 'social',
    '#selection_settings' => [],
    '#target_type' => 'user',
    '#tags' => TRUE,
    '#description' => $this
      ->t('To add multiple members, separate each member with a comma ( , ).'),
    '#title' => $this
      ->t('Select members to add by name or email address'),
    '#weight' => -1,
  ];
  $form['actions']['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Save'),
  ];
  $form['actions']['submit_cancel'] = [
    '#type' => 'submit',
    '#weight' => 999,
    '#value' => $this
      ->t('Back to event'),
    '#submit' => [
      [
        $this,
        'cancelForm',
      ],
    ],
    '#limit_validation_errors' => [],
  ];
  return $form;
}