class VpprPermissions in Vocabulary Permissions Per Role 8
Class VpprPermissions.
@package Drupal\vppr
Hierarchy
- class \Drupal\vppr\VpprPermissions implements ContainerInjectionInterface uses StringTranslationTrait
Expanded class hierarchy of VpprPermissions
1 file declares its use of VpprPermissions
- vppr.module in ./
vppr.module - Vocabulary Permissions Per Role.
File
- src/
VpprPermissions.php, line 16
Namespace
Drupal\vpprView source
class VpprPermissions implements ContainerInjectionInterface {
use StringTranslationTrait;
/**
* The entity manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Constructs a new instance.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity manager.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('entity_type.manager'));
}
/**
* Defines permissions related to vppr.
*/
public static function permissions() {
$perms = [];
$names = taxonomy_vocabulary_get_names();
$vocabularies = Vocabulary::loadMultiple($names);
foreach ($vocabularies as $vocabulary) {
$perms['administer ' . $vocabulary
->id() . ' vocabulary terms'] = [
'title' => t('Administer %name vocabulary terms', [
'%name' => $vocabulary
->label(),
'%vid' => $vocabulary
->id(),
]),
];
}
return $perms;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
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. | |
VpprPermissions:: |
protected | property | The entity manager. | |
VpprPermissions:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
|
VpprPermissions:: |
public static | function | Defines permissions related to vppr. | |
VpprPermissions:: |
public | function | Constructs a new instance. |