public static function Og::invalidateCache in Organic groups 8
Invalidate cache.
4 calls to Og::invalidateCache()
- GetUserGroupsTest::testIsMemberStates in tests/
src/ Kernel/ Entity/ GetUserGroupsTest.php - Tests member methods for states that other groups users are added to.
- GetUserGroupsTest::testOtherGroups in tests/
src/ Kernel/ Entity/ GetUserGroupsTest.php - Tests other groups users are added to.
- Og::createField in src/
Og.php - Create an organic groups field in a bundle.
- og_entity_delete in ./
og.module - Implements hook_entity_delete().
File
- src/
Og.php, line 318
Class
- Og
- A static helper class for OG.
Namespace
Drupal\ogCode
public static function invalidateCache() {
// @todo We should not be using drupal_static() review and remove.
// Reset static cache.
$caches = [
'og_user_access',
'og_user_access_alter',
'og_role_permissions',
'og_get_user_roles',
'og_get_permissions',
'og_get_entity_groups',
'og_get_membership',
'og_get_field_og_membership_properties',
'og_get_user_roles',
];
foreach ($caches as $cache) {
drupal_static_reset($cache);
}
// @todo Consider using a reset() method.
static::$cache = [];
// Invalidate the entity property cache.
// @todo We should not clear the entity type and field definition caches.
// @see https://github.com/Gizra/og/issues/219
\Drupal::entityTypeManager()
->clearCachedDefinitions();
\Drupal::service('entity_field.manager')
->clearCachedFieldDefinitions();
// Let other OG modules know we invalidate cache.
\Drupal::moduleHandler()
->invokeAll('og_invalidate_cache');
}