class HiddenLanguagePermissions in Hidden Language 8
Same name and namespace in other branches
- 2.x src/HiddenLanguagePermissions.php \Drupal\hidden_language\HiddenLanguagePermissions
Provides dynamic permissions of the filter module.
Hierarchy
- class \Drupal\hidden_language\HiddenLanguagePermissions implements ContainerInjectionInterface uses StringTranslationTrait
Expanded class hierarchy of HiddenLanguagePermissions
File
- src/
HiddenLanguagePermissions.php, line 12
Namespace
Drupal\hidden_languageView source
class HiddenLanguagePermissions implements ContainerInjectionInterface {
use StringTranslationTrait;
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static();
}
/**
* Returns an array of filter permissions.
*
* @return array
*/
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;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
HiddenLanguagePermissions:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
|
HiddenLanguagePermissions:: |
public | function | Returns an array of filter permissions. | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |