class TaxonomyAccessFixPermissions in Taxonomy access fix 8.3
Same name and namespace in other branches
- 8.2 src/TaxonomyAccessFixPermissions.php \Drupal\taxonomy_access_fix\TaxonomyAccessFixPermissions
Provides additional permissions for entities provided by Taxonomy module.
Hierarchy
- class \Drupal\taxonomy_access_fix\TaxonomyAccessFixPermissions implements ContainerInjectionInterface uses StringTranslationTrait
Expanded class hierarchy of TaxonomyAccessFixPermissions
File
- src/
TaxonomyAccessFixPermissions.php, line 13
Namespace
Drupal\taxonomy_access_fixView source
class TaxonomyAccessFixPermissions implements ContainerInjectionInterface {
use StringTranslationTrait;
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* Constructs a TaxonomyAccessFixPermissions 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'));
}
/**
* Gets additional permissions for Taxonomy Vocabulary entities.
*
* @return array
* Permissions array.
*/
public function getPermissions() {
$permissions = [];
$vocabularies = $this->entityTypeManager
->getStorage('taxonomy_vocabulary')
->loadMultiple();
foreach ($vocabularies as $vocabulary) {
$permissions['view terms in ' . $vocabulary
->id()] = [
'title' => $this
->t('View terms in %vocabulary', [
'%vocabulary' => $vocabulary
->label(),
]),
];
$permissions['reorder terms in ' . $vocabulary
->id()] = [
'title' => $this
->t('Reorder 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. | |
TaxonomyAccessFixPermissions:: |
protected | property | The entity type manager. | |
TaxonomyAccessFixPermissions:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
|
TaxonomyAccessFixPermissions:: |
public | function | Gets additional permissions for Taxonomy Vocabulary entities. | |
TaxonomyAccessFixPermissions:: |
public | function | Constructs a TaxonomyAccessFixPermissions instance. |