My setup is a bit unconventional. I’ve a view displaying a block, counting on a contextual filter (let’s name it product ID). I even have a customized block that renders this view programmatically as a result of I would like to incorporate this block in a number of locations on Drupal Developer web page and I’ve some customized logic that pulls Drupal Developer precise product ID to name Drupal Developer view with. Principally:
$view = Views::getView('view_id'); $args = ['product_id' => $whatever_product]; return $view->buildRenderable('views_block_id', $args);
Drupal Developer course of mainly works however, as ordinary, I will have issues when there are a number of such blocks on Drupal Developer web page. Views
solely caches utilizing Drupal Developer block id as a cache tag, so Drupal Developer first rendered view will get cached and displayed in every single place. Naturally, switching off Drupal Developer cache would work:
return $view->buildRenderable('views_block_id', $args, FALSE);
however not precisely what I take into consideration, I do not need to lose Drupal Developer advantages of caching.
My preliminary thought was fairly easy, let’s use customized cache tags in Drupal Developer view, because of views_custom_cache_tag
. So I did, together with Drupal Developer argument from Drupal Developer contextual filter:
views_block:view_id-views_block_id customized:{{ arguments.product_id }}
However it nonetheless does not work.
Is there some other method I missed? I am unable to push new cache tags proper earlier than I attempt to render Drupal Developer view. Drupal Developer ordinary view hooks do not get known as on this case (Drupal Developer second block already will get Drupal Developer cached variant, with out even bothering to go close to Drupal Developer hooks).