public function PostPermissions::permissions in Open Social 10.1.x
Same name and namespace in other branches
- 8.9 modules/social_features/social_post/src/Service/PostPermissions.php \Drupal\social_post\Service\PostPermissions::permissions()
- 8.8 modules/social_features/social_post/src/Service/PostPermissions.php \Drupal\social_post\Service\PostPermissions::permissions()
- 10.3.x modules/social_features/social_post/src/Service/PostPermissions.php \Drupal\social_post\Service\PostPermissions::permissions()
- 10.0.x modules/social_features/social_post/src/Service/PostPermissions.php \Drupal\social_post\Service\PostPermissions::permissions()
- 10.2.x modules/social_features/social_post/src/Service/PostPermissions.php \Drupal\social_post\Service\PostPermissions::permissions()
Generate post permissions for all post types.
Return value
array The post type permissions.
Overrides PostPermissionsInterface::permissions
File
- modules/
social_features/ social_post/ src/ Service/ PostPermissions.php, line 42
Class
- PostPermissions
- Provides dynamic permissions for posts of different types.
Namespace
Drupal\social_post\ServiceCode
public function permissions() {
$permissions = [];
/** @var \Drupal\social_post\Entity\PostTypeInterface $type */
foreach ($this->storage
->loadMultiple() as $type_id => $type) {
$permissions["add {$type_id} post entities"] = [
'title' => $this
->t('%type_name: Create new Post entities', [
'%type_name' => $type
->label(),
]),
];
}
return $permissions;
}