protected function CommentGroupContentFormatter::getPermissionInGroups in Open Social 8.8
Same name and namespace in other branches
- 8.9 modules/custom/group_core_comments/src/Plugin/Field/FieldFormatter/CommentGroupContentFormatter.php \Drupal\group_core_comments\Plugin\Field\FieldFormatter\CommentGroupContentFormatter::getPermissionInGroups()
- 8 modules/custom/group_core_comments/src/Plugin/Field/FieldFormatter/CommentGroupContentFormatter.php \Drupal\group_core_comments\Plugin\Field\FieldFormatter\CommentGroupContentFormatter::getPermissionInGroups()
- 8.2 modules/custom/group_core_comments/src/Plugin/Field/FieldFormatter/CommentGroupContentFormatter.php \Drupal\group_core_comments\Plugin\Field\FieldFormatter\CommentGroupContentFormatter::getPermissionInGroups()
- 8.3 modules/custom/group_core_comments/src/Plugin/Field/FieldFormatter/CommentGroupContentFormatter.php \Drupal\group_core_comments\Plugin\Field\FieldFormatter\CommentGroupContentFormatter::getPermissionInGroups()
- 8.4 modules/custom/group_core_comments/src/Plugin/Field/FieldFormatter/CommentGroupContentFormatter.php \Drupal\group_core_comments\Plugin\Field\FieldFormatter\CommentGroupContentFormatter::getPermissionInGroups()
- 8.5 modules/custom/group_core_comments/src/Plugin/Field/FieldFormatter/CommentGroupContentFormatter.php \Drupal\group_core_comments\Plugin\Field\FieldFormatter\CommentGroupContentFormatter::getPermissionInGroups()
- 8.6 modules/custom/group_core_comments/src/Plugin/Field/FieldFormatter/CommentGroupContentFormatter.php \Drupal\group_core_comments\Plugin\Field\FieldFormatter\CommentGroupContentFormatter::getPermissionInGroups()
- 8.7 modules/custom/group_core_comments/src/Plugin/Field/FieldFormatter/CommentGroupContentFormatter.php \Drupal\group_core_comments\Plugin\Field\FieldFormatter\CommentGroupContentFormatter::getPermissionInGroups()
- 10.3.x modules/custom/group_core_comments/src/Plugin/Field/FieldFormatter/CommentGroupContentFormatter.php \Drupal\group_core_comments\Plugin\Field\FieldFormatter\CommentGroupContentFormatter::getPermissionInGroups()
- 10.0.x modules/custom/group_core_comments/src/Plugin/Field/FieldFormatter/CommentGroupContentFormatter.php \Drupal\group_core_comments\Plugin\Field\FieldFormatter\CommentGroupContentFormatter::getPermissionInGroups()
- 10.1.x modules/custom/group_core_comments/src/Plugin/Field/FieldFormatter/CommentGroupContentFormatter.php \Drupal\group_core_comments\Plugin\Field\FieldFormatter\CommentGroupContentFormatter::getPermissionInGroups()
- 10.2.x modules/custom/group_core_comments/src/Plugin/Field/FieldFormatter/CommentGroupContentFormatter.php \Drupal\group_core_comments\Plugin\Field\FieldFormatter\CommentGroupContentFormatter::getPermissionInGroups()
Checks if account was granted permission in group.
1 call to CommentGroupContentFormatter::getPermissionInGroups()
- CommentGroupContentFormatter::viewElements in modules/
custom/ group_core_comments/ src/ Plugin/ Field/ FieldFormatter/ CommentGroupContentFormatter.php - Builds a renderable array for a field value.
File
- modules/
custom/ group_core_comments/ src/ Plugin/ Field/ FieldFormatter/ CommentGroupContentFormatter.php, line 131
Class
- CommentGroupContentFormatter
- Plugin implementation of the 'comment_group_content' formatter.
Namespace
Drupal\group_core_comments\Plugin\Field\FieldFormatterCode
protected function getPermissionInGroups($perm, AccountInterface $account, $group_contents, &$output) {
$renderer = \Drupal::service('renderer');
foreach ($group_contents as $group_content) {
$group = $group_content
->getGroup();
// Add cacheable dependency.
$membership = $group
->getMember($account);
$renderer
->addCacheableDependency($output, $membership);
if ($group
->hasPermission($perm, $account)) {
return AccessResult::allowed()
->cachePerUser();
}
}
// Fallback.
return AccessResult::forbidden()
->cachePerUser();
}