You are here

public function HiddenLanguagePermissions::permissions in Hidden Language 2.x

Same name and namespace in other branches
  1. 8 src/HiddenLanguagePermissions.php \Drupal\hidden_language\HiddenLanguagePermissions::permissions()

Returns an array of filter permissions.

Return value

array

1 string reference to 'HiddenLanguagePermissions::permissions'
hidden_language.permissions.yml in ./hidden_language.permissions.yml
hidden_language.permissions.yml

File

src/HiddenLanguagePermissions.php, line 28

Class

HiddenLanguagePermissions
Provides dynamic permissions of the filter module.

Namespace

Drupal\hidden_language

Code

public function permissions() {
  $permissions = [];
  $languages = \Drupal::languageManager()
    ->getLanguages();
  foreach ($languages as $langcode => $language) {
    $permissions["access hidden language {$langcode}"] = [
      'title' => $this
        ->t('Access hidden language @language', [
        '@language' => $language
          ->getName(),
      ]),
      'description' => $this
        ->t('Access @language language when it is hidden.', [
        '@language' => $language
          ->getName(),
      ]),
    ];
  }
  return $permissions;
}