/** * @param Entity\Block $block * @return bool */ function clearMenuCache(Entity\Block $block) { if ($block->menuItemTranslation) { $url = $block->menuItemTranslation->getUrl(true); } elseif ($block->menuItem) { $url = $block->menuItem->getUrl(true); } else { return false; } $url = str_ireplace(['https://', 'http://'], '', $url); $this->cache->deleteCache($url); return true; }
/** * Callback function to clear the cache if a block element is created or changed */ public function clearCache() { $location = $this->request->post('location', false); $this->cache->deleteCache($location); }