class LanguageAccessPermissions in Language access 8
Provides language module permissions.
Hierarchy
- class \Drupal\language_access\LanguageAccessPermissions implements ContainerInjectionInterface
Expanded class hierarchy of LanguageAccessPermissions
1 file declares its use of LanguageAccessPermissions
- LanguageAccessPermissionsTest.php in tests/
src/ Kernel/ LanguageAccessPermissionsTest.php
File
- src/
LanguageAccessPermissions.php, line 12
Namespace
Drupal\language_accessView source
class LanguageAccessPermissions implements ContainerInjectionInterface {
/**
* The REST resource config storage.
*
* @var \Drupal\Core\Language\LanguageManagerInterface
*/
protected $languageManager;
/**
* Constructs a new LanguageAccessPermissions instance.
*
* @param \Drupal\Core\Language\LanguageManagerInterface $language_manager
* The language manager.
*/
public function __construct(LanguageManagerInterface $language_manager) {
$this->languageManager = $language_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('language_manager'));
}
/**
* Returns an array of language access permissions.
*
* @return array
* Permissions.
*/
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;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LanguageAccessPermissions:: |
protected | property | The REST resource config storage. | |
LanguageAccessPermissions:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
|
LanguageAccessPermissions:: |
public | function | Returns an array of language access permissions. | |
LanguageAccessPermissions:: |
public | function | Constructs a new LanguageAccessPermissions instance. |