class TaxonomyViewsIntegratorPermissions in Taxonomy Views Integrator 8
Permissions generator for TVI.
Hierarchy
- class \Drupal\tvi\TaxonomyViewsIntegratorPermissions implements ContainerInjectionInterface uses StringTranslationTrait
Expanded class hierarchy of TaxonomyViewsIntegratorPermissions
File
- src/
TaxonomyViewsIntegratorPermissions.php, line 13
Namespace
Drupal\tviView source
class TaxonomyViewsIntegratorPermissions implements ContainerInjectionInterface {
use StringTranslationTrait;
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Constructs a TaxonomyViewsIntegratorPermissions instance.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type 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'));
}
/**
* Get permissions for Taxonomy Views Integrator.
*
* @return array
* Permissions array.
*/
public function permissions() {
$permissions = [];
foreach ($this->entityTypeManager
->getStorage('taxonomy_vocabulary')
->loadMultiple() as $vocabulary) {
$permissions += [
'define view for vocabulary ' . $vocabulary
->id() => [
'title' => $this
->t('Define the view override for the vocabulary %vocabulary', [
'%vocabulary' => $vocabulary
->label(),
]),
],
];
$permissions += [
'define view for terms in ' . $vocabulary
->id() => [
'title' => $this
->t('Define the view override for terms in %vocabulary', [
'%vocabulary' => $vocabulary
->label(),
]),
],
];
}
return $permissions;
}
}
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. | |
TaxonomyViewsIntegratorPermissions:: |
protected | property | The entity type manager. | |
TaxonomyViewsIntegratorPermissions:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
|
TaxonomyViewsIntegratorPermissions:: |
public | function | Get permissions for Taxonomy Views Integrator. | |
TaxonomyViewsIntegratorPermissions:: |
public | function | Constructs a TaxonomyViewsIntegratorPermissions instance. |