You are here

public function RoleSectionStorage::getPotentialRolesFiltered in Workbench Access 8

Gets a list of potential roles for assigning users.

Parameters

string $id: The section id.

Return value

array An array of roles keyed by rid with rid values.

Overrides RoleSectionStorageInterface::getPotentialRolesFiltered

File

src/RoleSectionStorage.php, line 137

Class

RoleSectionStorage
Defines a role-section storage that uses the State API.

Namespace

Drupal\workbench_access

Code

public function getPotentialRolesFiltered($id) {
  $list = [];
  $roles = $this->roleStorage
    ->loadMultiple();
  foreach ($roles as $rid => $role) {
    if ($role
      ->hasPermission('use workbench access')) {
      $list[$rid] = $role
        ->label();
    }
  }
  return $list;
}