I have a custom block with some values I can access in twig template of that block. Let's say variable product_type
and in same twig file I'm adding another view block like
{{ drupal_block('views_block:my-view-block_1', {product_type: 'clothes'}) }}
and for that block's hook
function myModule_views_pre_view(&$view, &$display_id, &$args){
// I want that "product_type" variable here in this hook
// because I want to add a filter here like this:
$view->display_handler->display['display_options']['filters']['field_product_type_target_id']['default_value'] = $product_type;
}
Above hook is being invoked but I cannot get product_type
in hook function. I'm not sure if that is the correct way to do it but I really need to pass that value from first block to second block and use that value in second block to filter out results. It's been 2 days I'm trying to figure this out. Any help would be highly appreciated :)
Thanks & Regards.