You are here

public function GroupRequestMembershipRejectForm::buildForm in Open Social 8.9

Same name and namespace in other branches
  1. 10.3.x modules/social_features/social_group/modules/social_group_request/src/Form/GroupRequestMembershipRejectForm.php \Drupal\social_group_request\Form\GroupRequestMembershipRejectForm::buildForm()
  2. 10.0.x modules/social_features/social_group/modules/social_group_request/src/Form/GroupRequestMembershipRejectForm.php \Drupal\social_group_request\Form\GroupRequestMembershipRejectForm::buildForm()
  3. 10.1.x modules/social_features/social_group/modules/social_group_request/src/Form/GroupRequestMembershipRejectForm.php \Drupal\social_group_request\Form\GroupRequestMembershipRejectForm::buildForm()
  4. 10.2.x modules/social_features/social_group/modules/social_group_request/src/Form/GroupRequestMembershipRejectForm.php \Drupal\social_group_request\Form\GroupRequestMembershipRejectForm::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 FormInterface::buildForm

File

modules/social_features/social_group/modules/social_group_request/src/Form/GroupRequestMembershipRejectForm.php, line 110

Class

GroupRequestMembershipRejectForm
Provides a confirmation form before rejecting membership.

Namespace

Drupal\social_group_request\Form

Code

public function buildForm(array $form, FormStateInterface $form_state, GroupInterface $group = NULL, GroupContentInterface $group_content = NULL) {
  $this->group = $group;
  $this->groupContent = $group_content;
  $form['#attributes']['class'][] = 'form--default';
  $form['question'] = [
    '#type' => 'html_tag',
    '#tag' => 'p',
    '#value' => $this
      ->t('Are you sure you want to reject the membership request for @name?', [
      '@name' => $group_content
        ->getEntity()
        ->getDisplayName(),
    ]),
    '#weight' => 1,
    '#prefix' => '<div class="card"><div class="card__block">',
    '#suffix' => '</div></div>',
  ];
  $form['actions']['#type'] = 'actions';
  $form['actions']['cancel'] = [
    '#type' => 'link',
    '#title' => $this
      ->t('Cancel'),
    '#attributes' => [
      'class' => [
        'button',
        'button--flat',
        'btn',
        'btn-flat',
        'waves-effect',
        'waves-btn',
      ],
    ],
    '#url' => $this
      ->getCancelUrl(),
  ];
  $form['actions']['submit'] = [
    '#type' => 'submit',
    '#value' => $this
      ->t('Yes'),
    '#button_type' => 'primary',
  ];
  return $form;
}