You are here

public function GroupRoleForm::buildForm in Group 8

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

File

src/Entity/Form/GroupRoleForm.php, line 19

Class

GroupRoleForm
Form controller for group role forms.

Namespace

Drupal\group\Entity\Form

Code

public function buildForm(array $form, FormStateInterface $form_state) {

  /** @var \Drupal\group\Entity\GroupRoleInterface $group_role */
  $group_role = $this->entity;
  if ($group_role
    ->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);
}