You are here

public function AccessStorage::getSubmittedRolesGrantedAccess in Permissions by Term 8.2

Same name and namespace in other branches
  1. 8 src/Service/AccessStorage.php \Drupal\permissions_by_term\Service\AccessStorage::getSubmittedRolesGrantedAccess()

Gets submitted roles with granted access from form.

Return value

array An array with chosen roles.

1 call to AccessStorage::getSubmittedRolesGrantedAccess()
AccessStorage::saveTermPermissions in src/Service/AccessStorage.php

File

src/Service/AccessStorage.php, line 74

Class

AccessStorage
Class AccessStorage.

Namespace

Drupal\permissions_by_term\Service

Code

public function getSubmittedRolesGrantedAccess(FormStateInterface $form_state) {
  $aRoles = $form_state
    ->getValue('access')['role'];
  $aChosenRoles = [];
  foreach ($aRoles as $sRole) {
    if ($sRole !== 0) {
      $aChosenRoles[] = $sRole;
    }
  }
  return $aChosenRoles;
}