You are here

public function GroupPermissionsRoleSpecificForm::buildForm in Group 8

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

\Drupal\group\Entity\GroupRoleInterface $group_role: The group role used for this form.

Return value

array The form structure.

Overrides GroupPermissionsForm::buildForm

File

src/Form/GroupPermissionsRoleSpecificForm.php, line 47

Class

GroupPermissionsRoleSpecificForm
Provides the user permissions administration form for a specific group role.

Namespace

Drupal\group\Form

Code

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