New answers tagged blocks
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 '...
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']...
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 ...
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="...
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 ...
Top 50 recent answers are included
Related Tags
blocks × 28807 × 811
8 × 641
theming × 629
views × 586
nodes × 184
forms × 139
users × 126
caching × 107
entities × 101
routes × 95
6 × 93
hooks × 83
navigation × 75
javascript × 74
taxonomy-terms × 59
media × 56
panels × 54
9 × 49
search × 46
i18n-l10n × 44
ajax × 41
plugins × 31
database × 24
configuration × 23