New answers tagged

0 votes

Blocks in menu region visible only for authorised users - how to find a reason?

It was coming from parent theme: $variables['page']['menu'] = NULL;
user avatar
  • 189
2 votes
Accepted

How to render a custom block with variables from another custom block twig template

Variables are passed from PHP/preprocess to Twig, but never vice versa. Instead of preprocessesing the filter of the second block, replace the product type filter in the 2nd views block with a "...
user avatar
  • 4,909
1 vote

Access preprocess variable globally

$variables['elements']['content']['#block_content'] is not available in other templates, which you can target directly or via the general HOOK_preprocess((&$variables, $hook) and $hook != 'block'. ...
user avatar
  • 87.9k
0 votes

Determine which region a menu block is rendered in

The $variables["content"]["#attributes"] seem not to work anymore in all cases. The attribute tag has to be targeted to the specific content within the block. Hence $variables[&...
user avatar
0 votes

Splitting exposed form filters amongst several blocks

Although not perfect, a possible solution is to modify the exposed form. For me, the file was views-exposed-form--search.html.twig. You can then display your separate form elements using things like: {...
user avatar
  • 323
3 votes
Accepted

How can I hide a block from regions?

Block configuration entities need a region, but not blocks in general. Twig Tweak can generate the block config on the fly and doesn't need them to be stored in the database: {{ drupal_block('...
user avatar
  • 87.9k

Top 50 recent answers are included