class Permissions
Same name in this branch
- 11.x core/modules/user/src/Plugin/views/field/Permissions.php \Drupal\user\Plugin\views\field\Permissions
- 11.x core/modules/user/src/Plugin/views/filter/Permissions.php \Drupal\user\Plugin\views\filter\Permissions
Same name in other branches
- 9 core/modules/content_moderation/src/Permissions.php \Drupal\content_moderation\Permissions
- 9 core/modules/user/src/Plugin/views/field/Permissions.php \Drupal\user\Plugin\views\field\Permissions
- 9 core/modules/user/src/Plugin/views/filter/Permissions.php \Drupal\user\Plugin\views\filter\Permissions
- 8.9.x core/modules/content_moderation/src/Permissions.php \Drupal\content_moderation\Permissions
- 8.9.x core/modules/user/src/Plugin/views/field/Permissions.php \Drupal\user\Plugin\views\field\Permissions
- 8.9.x core/modules/user/src/Plugin/views/filter/Permissions.php \Drupal\user\Plugin\views\filter\Permissions
- 10 core/modules/content_moderation/src/Permissions.php \Drupal\content_moderation\Permissions
- 10 core/modules/user/src/Plugin/views/field/Permissions.php \Drupal\user\Plugin\views\field\Permissions
- 10 core/modules/user/src/Plugin/views/filter/Permissions.php \Drupal\user\Plugin\views\filter\Permissions
Defines a class for dynamic permissions based on transitions.
@internal
Hierarchy
- class \Drupal\content_moderation\Permissions uses \Drupal\Core\StringTranslation\StringTranslationTrait
Expanded class hierarchy of Permissions
1 file declares its use of Permissions
- ContentModerationPermissionsTest.php in core/
modules/ content_moderation/ tests/ src/ Kernel/ ContentModerationPermissionsTest.php
11 string references to 'Permissions'
- d6_user_role.yml in core/
modules/ user/ migrations/ d6_user_role.yml - core/modules/user/migrations/d6_user_role.yml
- d7_user_role.yml in core/
modules/ user/ migrations/ d7_user_role.yml - core/modules/user/migrations/d7_user_role.yml
- EntityUserRole::import in core/
modules/ user/ src/ Plugin/ migrate/ destination/ EntityUserRole.php - Import the row.
- PermissionHandler::getYamlDiscovery in core/
modules/ user/ src/ PermissionHandler.php - Gets the YAML discovery.
- Role::prepareRow in core/
modules/ user/ src/ Plugin/ migrate/ source/ d6/ Role.php - Adds additional data to the row.
File
-
core/
modules/ content_moderation/ src/ Permissions.php, line 14
Namespace
Drupal\content_moderationView source
class Permissions {
use StringTranslationTrait;
/**
* Returns an array of transition permissions.
*
* @return array
* The transition permissions.
*/
public function transitionPermissions() {
$permissions = [];
/** @var \Drupal\workflows\WorkflowInterface $workflow */
foreach (Workflow::loadMultipleByType('content_moderation') as $workflow) {
foreach ($workflow->getTypePlugin()
->getTransitions() as $transition) {
$permissions['use ' . $workflow->id() . ' transition ' . $transition->id()] = [
'title' => $this->t('%workflow workflow: Use %transition transition.', [
'%workflow' => $workflow->label(),
'%transition' => $transition->label(),
]),
'description' => $this->formatPlural(count($transition->from()), 'Move content from %from state to %to state.', 'Move content from %from states to %to state.', [
'%from' => implode(', ', array_map([
State::class,
'labelCallback',
], $transition->from())),
'%to' => $transition->to()
->label(),
]),
'dependencies' => [
$workflow->getConfigDependencyKey() => [
$workflow->getConfigDependencyName(),
],
],
];
}
}
return $permissions;
}
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overrides |
---|---|---|---|---|
Permissions::transitionPermissions | public | function | Returns an array of transition permissions. | |
StringTranslationTrait::$stringTranslation | protected | property | The string translation service. | 3 |
StringTranslationTrait::formatPlural | protected | function | Formats a string containing a count of items. | |
StringTranslationTrait::getNumberOfPlurals | protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait::getStringTranslation | protected | function | Gets the string translation service. | |
StringTranslationTrait::setStringTranslation | public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait::t | protected | function | Translates a string to the current language or to a given language. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.