New answers tagged

2 votes

How to convert context_definitions to PHP attribute syntax?

At the moment, only two annotation classes have been converted to attribute classes. Blocks defined by Drupal core modules still use annotations, like the AnnounceBlock class. /** * Provides an '...
apaderno's user avatar
  • 97k
0 votes

Preprocess variables only for certain blocks

In Drupal 10 (presumably 8 & beyond), you can dig into the $vars array to isolate a particular block type/bundle: function mytheme_preprocess_block(&$vars){ $block_content = $vars['elements']...
beltouche's user avatar
  • 719
0 votes

Is it possible to make a theme hook suggestion for blocks according to content type?

After trying more solutions in different answers, modifying this one finally worked for me: How to make a theme hook suggestion for blocks according to region? use Drupal\block\Entity\Block; function ...
huijing's user avatar
  • 199
0 votes

How to unlink the site name?

Override the block--system-branding-block.html.twig theme file. Most core themes have something like this in it: {% if site_name %} <a href="{{ path('<front>') }}" rel="...
cilefen's user avatar
  • 5,568
4 votes
Accepted

Is possible to have OR logic on block visibility?

Use the module Block Visibility Groups, This module not only allows you to combine conditions with OR logic, but also makes them reusable, so you don't need to repeat the complex logic for each block ...
4uk4's user avatar
  • 98.2k

Top 50 recent answers are included