protected function MediaRevisionPermissions::buildPermissions in Media Revisions UI 8
Same name and namespace in other branches
- 2.0.x src/MediaRevisionPermissions.php \Drupal\media_revisions_ui\MediaRevisionPermissions::buildPermissions()
Returns a list of media revision permissions for a given media type.
Parameters
\Drupal\media\MediaTypeInterface $type: The media type.
Return value
array An associative array of permission names and descriptions.
1 call to MediaRevisionPermissions::buildPermissions()
- MediaRevisionPermissions::mediaRevisionTypePermissions in src/
MediaRevisionPermissions.php - Returns an array of media revision type permissions.
File
- src/
MediaRevisionPermissions.php, line 69
Class
- MediaRevisionPermissions
- Provides dynamic permissions for each media revision type.
Namespace
Drupal\media_revisions_uiCode
protected function buildPermissions(MediaTypeInterface $type) {
$type_id = $type
->id();
$type_params = [
'%type_name' => $type
->label(),
];
return [
"view {$type_id} media revisions" => [
'title' => $this
->t('%type_name: View media revisions', $type_params),
'description' => $this
->t('To view a revision, you also need permission to view the media item.'),
],
"revert {$type_id} media revisions" => [
'title' => $this
->t('%type_name: Revert media revisions', $type_params),
'description' => $this
->t('To revert a revision, you also need permission to update the media item.'),
],
"delete {$type_id} media revisions" => [
'title' => $this
->t('%type_name: Delete media revisions', $type_params),
'description' => $this
->t('To delete a revision, you also need permission to delete the media item.'),
],
];
}