protected function RoleFormController::actions

Returns an array of supported actions for the current entity form.

Overrides EntityFormController::actions

File

drupal/core/modules/user/lib/Drupal/user/RoleFormController.php, line 54
Contains \Drupal\user\RoleFormController.

Class

RoleFormController
Form controller for the role entity edit forms.

Namespace

Drupal\user

Code

protected function actions(array $form, array &$form_state) {
  $actions = parent::actions($form, $form_state);

  // Disable delete of new and built-in roles.
  $actions['delete']['#access'] = !$this->entity
    ->isNew() && !in_array($this->entity
    ->id(), array(
    DRUPAL_ANONYMOUS_RID,
    DRUPAL_AUTHENTICATED_RID,
  ));
  return $actions;
}