Now, it respects the cache context, and the block is unique per page.Ģ) For now, to work around this, you can just output what's in your block in it's own template. the block placed through /admin/structure/block).īased on what I have learned about Drupal 8, I added the cache contexts to my build array: public function build() The issue is a custom block plugin I have on a views search page that contains custom filters (sort of like a custom replacement for exposed filters. The get() method is normally used within an if statement so that if the result of the get() method is then passed upstream, rather than continuing the execution of the function.I have run into an issue where a block that should be unique per page isn't for logged-out users. This method will either return "false" if the cache is not found, or a stdClass object that contains the cache data saved in the "data" parameter. $output = \Drupal::cache()->get($cacheId) This method accepts the cache ID you want to get. For example, you can pass in the tag "node:1" so that if the entity node 1 is changed then this cache item is invalidated so that new caches can be created.Ĭonversely, the get() method is used to get some data from the cache system. These are used by Drupal to invalidate this cache item when other things on the site change.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |