You are here

public function LanguageAccessPermissions::permissions in Language access 8

Returns an array of language access permissions.

Return value

array Permissions.

1 string reference to 'LanguageAccessPermissions::permissions'
language_access.permissions.yml in ./language_access.permissions.yml
language_access.permissions.yml

File

src/LanguageAccessPermissions.php, line 45

Class

LanguageAccessPermissions
Provides language module permissions.

Namespace

Drupal\language_access

Code

public function permissions() {
  $permissions = [];
  $languages = $this->languageManager
    ->getLanguages();
  foreach ($languages as $language) {
    $permissions['access language ' . $language
      ->getId()] = [
      'title' => t('Access language @language', [
        '@language' => $language
          ->getName(),
      ]),
    ];
  }
  return $permissions;
}