class Permissions in Workbench Moderation State Access 8
Defines a class for dynamic permissions based on states.
Hierarchy
- class \Drupal\workbench_moderation_state_access\Permissions uses StringTranslationTrait
Expanded class hierarchy of Permissions
File
- src/
Permissions.php, line 11
Namespace
Drupal\workbench_moderation_state_accessView source
class Permissions {
use StringTranslationTrait;
/**
* Returns an array of edit permissions.
*
* @return array
* The edit permissions.
*/
public function editPermissions() {
// @todo write a test for this.
$perms = [];
/* @var \Drupal\workbench_moderation\ModerationStateInterface $state */
foreach (ModerationState::loadMultiple() as $id => $state) {
$perms['edit content in the ' . $id . ' state'] = [
'title' => $this
->t('Edit content when in the %state_name state.', [
'%state_name' => $state
->label(),
]),
];
}
return $perms;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Permissions:: |
public | function | Returns an array of edit permissions. | |
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. |