You are here

function _social_group_cache_tags in Open Social 8.9

Same name and namespace in other branches
  1. 8 modules/social_features/social_group/social_group.module \_social_group_cache_tags()
  2. 8.2 modules/social_features/social_group/social_group.module \_social_group_cache_tags()
  3. 8.3 modules/social_features/social_group/social_group.module \_social_group_cache_tags()
  4. 8.4 modules/social_features/social_group/social_group.module \_social_group_cache_tags()
  5. 8.5 modules/social_features/social_group/social_group.module \_social_group_cache_tags()
  6. 8.6 modules/social_features/social_group/social_group.module \_social_group_cache_tags()
  7. 8.7 modules/social_features/social_group/social_group.module \_social_group_cache_tags()
  8. 8.8 modules/social_features/social_group/social_group.module \_social_group_cache_tags()
  9. 10.3.x modules/social_features/social_group/social_group.module \_social_group_cache_tags()
  10. 10.0.x modules/social_features/social_group/social_group.module \_social_group_cache_tags()
  11. 10.1.x modules/social_features/social_group/social_group.module \_social_group_cache_tags()
  12. 10.2.x modules/social_features/social_group/social_group.module \_social_group_cache_tags()

Get group cache tags.

Parameters

\Drupal\group\Entity\GroupInterface $group: The GroupInterface.

Return value

array An array of cache tags related to groups.

4 calls to _social_group_cache_tags()
_social_flexible_group_edit_submit in modules/social_features/social_group/modules/social_group_flexible_group/social_group_flexible_group.module
Custom form submit handler for editing a flexible group.
_social_group_action_form_submit in modules/social_features/social_group/social_group.module
Form submit for group join / leave form.
_social_group_type_edit_submit in modules/social_features/social_group/social_group.module
Form submit for removing members from a group so we can clear caches.
_social_membership_delete_form_submit in modules/social_features/social_group/social_group.module
Form submit for removing members from a group so we can clear caches.

File

modules/social_features/social_group/social_group.module, line 1319
The Social group module.

Code

function _social_group_cache_tags(GroupInterface $group) {

  // Group views.
  $tags = [
    'group_list',
    'group_content_list',
    'group_view',
    'group_content_view',
  ];

  // Add cache tags that are based on id.
  $tags[] = 'group_hero:' . $group
    ->id();

  // Add cache tags for the blocks.
  $tags[] = 'group_block:' . $group
    ->id();
  $current_user = \Drupal::currentUser();
  if ($group_membership = $group
    ->getMember($current_user)) {
    $group_content = $group_membership
      ->getGroupContent();
    $tags[] = 'group_content:' . $group_content
      ->id();
  }
  return $tags;
}