public function GroupContent::getListCacheTagsToInvalidate in Group 2.0.x
Same name and namespace in other branches
- 8 src/Entity/GroupContent.php \Drupal\group\Entity\GroupContent::getListCacheTagsToInvalidate()
The list cache tags to invalidate for this entity.
Return value
string[] Set of list cache tags.
Overrides EntityBase::getListCacheTagsToInvalidate
File
- src/
Entity/ GroupContent.php, line 238
Class
- GroupContent
- Defines the Group content entity.
Namespace
Drupal\group\EntityCode
public function getListCacheTagsToInvalidate() {
$tags = parent::getListCacheTagsToInvalidate();
$group_id = $this
->get('gid')->target_id;
$entity_id = $this
->get('entity_id')->target_id;
$plugin_id = $this
->getGroupContentType()
->getRelationPluginId();
// A specific group gets any content, regardless of plugin used.
// E.g.: A group's list of entities can be flushed with this.
$tags[] = "group_content_list:group:{$group_id}";
// A specific entity gets added to any group, regardless of plugin used.
// E.g.: An entity's list of groups can be flushed with this.
$tags[] = "group_content_list:entity:{$entity_id}";
// Any entity gets added to any group using a specific plugin.
// E.g.: A list of all memberships anywhere can be flushed with this.
$tags[] = "group_content_list:plugin:{$plugin_id}";
// A specific group gets any content using a specific plugin.
// E.g.: A group's list of members can be flushed with this.
$tags[] = "group_content_list:plugin:{$plugin_id}:group:{$group_id}";
// A specific entity gets added to any group using a specific plugin.
// E.g.: A user's list of memberships can be flushed with this.
$tags[] = "group_content_list:plugin:{$plugin_id}:entity:{$entity_id}";
return $tags;
}