Example #1
0
 /**
  * @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;
 }
Example #2
0
 /**
  * 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);
 }