Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
I installed the module and added some classes in some blocks. The problem is that I need to load this blocks in various node types (programatically) and unset the classes that I configured for this blocks.
In my theme.theme file I used this code:
//Get people block
$block_pople = Block::load('personas');
$block_pople->unsetThirdPartySetting('block_class', 'classes');
$block_people_content = \Drupal::entityTypeManager() ->getViewBuilder('block') ->view($block_pople);
$variables['people_block'] = $block_people_content;
If I debug the result of the $block_pople, I see that the classes are removed well, but when I render the block in the node, the classes are present. I'm doing something wrong?
Comment | File | Size | Author |
---|---|---|---|
#2 | 6724e21e6b.png | 26.85 KB | AstonVictor |
#2 | config_css_classes.patch | 2.29 KB | AstonVictor |
Comments
Comment #2
AstonVictor CreditAttribution: AstonVictor at DevBranch commentedHi there!
I added a patch that added new config field 'Disable css class(es) on pages'.
Please, check it.
Comment #3
berenddeboer CreditAttribution: berenddeboer commentedIt seems this patch would only address a minority of the very specific use cases imaginable. So probably more something that belongs in a a separate module.