class ConfigPagesPermissions in Config Pages 8.2
Same name and namespace in other branches
- 8.3 src/ConfigPagesPermissions.php \Drupal\config_pages\ConfigPagesPermissions
Provides rest module permissions.
Hierarchy
- class \Drupal\config_pages\ConfigPagesPermissions implements ContainerInjectionInterface uses StringTranslationTrait
Expanded class hierarchy of ConfigPagesPermissions
File
- src/
ConfigPagesPermissions.php, line 13
Namespace
Drupal\config_pagesView source
class ConfigPagesPermissions implements ContainerInjectionInterface {
use StringTranslationTrait;
/**
* The config_pages config storage.
*
* @var \Drupal\Core\Entity\EntityManagerInterface
*/
protected $storage;
/**
* Constructs a new ConfigPagesPermissions instance.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*
* @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
* @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->storage = $entity_type_manager
->getStorage('config_pages_type');
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('entity_type.manager'));
}
/**
* Returns an array of Config pages permissions.
*
* @return array
* Permissions.
*/
public function permissions() {
$permissions = [];
$config_pages = $this->storage
->loadMultiple();
foreach ($config_pages as $config_page) {
$permissions['view ' . $config_page
->id() . ' config page entity'] = [
'title' => $this
->t('View the @label config page entity', [
'@label' => $config_page
->label(),
]),
];
$permissions['edit ' . $config_page
->id() . ' config page entity'] = [
'title' => $this
->t('Edit the @label config page entity', [
'@label' => $config_page
->label(),
]),
];
}
return $permissions;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigPagesPermissions:: |
protected | property | The config_pages config storage. | |
ConfigPagesPermissions:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
|
ConfigPagesPermissions:: |
public | function | Returns an array of Config pages permissions. | |
ConfigPagesPermissions:: |
public | function | Constructs a new ConfigPagesPermissions instance. | |
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. |