You are here

public function GroupRoleDeleteForm::buildForm in Group 8

Same name and namespace in other branches
  1. 2.0.x src/Entity/Form/GroupRoleDeleteForm.php \Drupal\group\Entity\Form\GroupRoleDeleteForm::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 EntityDeleteForm::buildForm

File

src/Entity/Form/GroupRoleDeleteForm.php, line 16

Class

GroupRoleDeleteForm
Provides a form for group role deletion.

Namespace

Drupal\group\Entity\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {
  if ($this->entity
    ->isInternal()) {
    return [
      '#title' => $this
        ->t('Error'),
      'description' => [
        '#prefix' => '<p>',
        '#suffix' => '</p>',
        '#markup' => $this
          ->t('Cannot edit an internal group role directly.'),
      ],
    ];
  }
  return parent::buildForm($form, $form_state);
}