You are here

public function FlagPermissions::permissions in Flag 8.4

Returns an array of dynamic flag permissions.

Return value

array An array of permissions.

See also

Drupal\flag\FlagInterface::getPermissions().

1 string reference to 'FlagPermissions::permissions'
flag.permissions.yml in ./flag.permissions.yml
flag.permissions.yml

File

src/Permissions/FlagPermissions.php, line 46

Class

FlagPermissions
Provides dynamic permissions for defined flags.

Namespace

Drupal\flag\Permissions

Code

public function permissions() {
  $permissions = [];

  // Get a list of flags from the FlagService.
  $flags = $this->flagService
    ->getAllFlags();

  // Provide flag and unflag permissions for each flag.
  foreach ($flags as $flag_name => $flag) {
    $permissions += $flag
      ->actionPermissions();
  }
  return $permissions;
}