class UnpublishedNodePermissions in Unpublished Node Permissions 8
Provides dynamic permissions for nodes of different types.
Hierarchy
- class \Drupal\node\NodePermissions uses StringTranslationTrait
- class \Drupal\unpublished_node_permissions\UnpublishedNodePermissions
Expanded class hierarchy of UnpublishedNodePermissions
File
- src/
UnpublishedNodePermissions.php, line 11
Namespace
Drupal\unpublished_node_permissionsView source
class UnpublishedNodePermissions extends NodePermissions {
/**
* Returns a list of node permissions for a given node type.
*
* @param \Drupal\node\Entity\NodeType $type
* The node type.
*
* @return array
* An associative array of permission names and descriptions.
*/
protected function buildPermissions(NodeType $type) {
$type_id = $type
->id();
$type_params = [
'%type_name' => $type
->label(),
];
return [
"view {$type_id} unpublished content" => [
'title' => $this
->t('%type_name: View unpublished content', $type_params),
],
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
NodePermissions:: |
public | function | Returns an array of node type 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. | |
UnpublishedNodePermissions:: |
protected | function |
Returns a list of node permissions for a given node type. Overrides NodePermissions:: |