class Permissions in Payment 8.2
Provides dynamic permissions
Hierarchy
- class \Drupal\payment\Permissions implements ContainerInjectionInterface uses StringTranslationTrait
Expanded class hierarchy of Permissions
1 file declares its use of Permissions
- PermissionsTest.php in tests/
src/ Unit/ PermissionsTest.php
File
- src/
Permissions.php, line 14
Namespace
Drupal\paymentView source
class Permissions implements ContainerInjectionInterface {
use StringTranslationTrait;
/**
* The payment method configuration configuration manager.
*
* @var \Drupal\Component\Plugin\PluginManagerInterface
*/
protected $paymentMethodConfigurationManager;
/**
* Constructs a new instance.
*
* @param \Drupal\Core\StringTranslation\TranslationInterface $string_translation
* @param \Drupal\Component\Plugin\PluginManagerInterface $payment_method_configuration_manager
*/
public function __construct(TranslationInterface $string_translation, PluginManagerInterface $payment_method_configuration_manager) {
$this->paymentMethodConfigurationManager = $payment_method_configuration_manager;
$this->stringTranslation = $string_translation;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container
->get('string_translation'), $container
->get('plugin.manager.payment.method_configuration'));
}
/**
* Returns permissions.
*
* @return array[]
* The structure is the same as that of *.permissions.yml files.
*/
public function getPermissions() {
$permissions = [];
$definitions = $this->paymentMethodConfigurationManager
->getDefinitions();
foreach ($definitions as $plugin_id => $definition) {
$permissions['payment.payment_method_configuration.create.' . $plugin_id] = array(
'title' => $this
->t('Create %plugin_label payment method configurations', array(
'%plugin_label' => $definition['label'],
)),
);
}
return $permissions;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Permissions:: |
protected | property | The payment method configuration configuration manager. | |
Permissions:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
|
Permissions:: |
public | function | Returns permissions. | |
Permissions:: |
public | function | Constructs a new 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. |