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.
Hi, I tried to add a prefix to my bean-block of specific bundle-type.
I can rewrite the content of the bean - but I am not able to add a static prefix to all "bean-block-titles" of this specific type.
I tried a lot of different ways: here is my last:
function mymodule_preprocess_entity(&$variables) {
if ($variables['entity_type'] == 'bean') {
if ($variables['bean']->type == 'feeds') {
$feeds_title = $variables['title'];
$feeds_title = "<h2><span class='iconbg'> </span>$feeds_title</h2>";
// dpm($variables);
$variables['title'] = $feeds_title;
}
}
}
Comments
Comment #1
vistree CreditAttribution: vistree commentedHi,
I recognized, that I need to modify the block containing the bean in any way.
Do you have a suggestion how to do this on a bean-bundle-type base?
Comment #2
vistree CreditAttribution: vistree commentedI found out, that I can override the bean-block-title general by using hook_block_view_alter.
But there I can only select block by module ( if($block->module == 'bean') { ) and not by bean-type. Is it possible to combine the preprocess_entity and the block_view_alter to modify the block title of beans by bean-type???