Working with Beans + homebox a lot, I noticed that the outputted block title in "Add a Block section" uses the non-translatable Bean Label instead of the separate field_title that is outputted (in my case) as the $block->subject. While this affects my beans outputted in homebox, it might affect other modules too that render blocks.

The cause seems to be because $info['info'] in $allowed_blocks, passed to homebox_add_link(), is set before homebox_prepare_block() is run which, in my case, changes the block 'subject'.

by adding this code in homebox_build the $allowed_blocks[$block->module][$block->delta]['info'] is updated with the latest $block->subject

        if (!empty($block->subject)) {
          // Makes sure that $allowed_block's 'info' (subject/title) is updated with any change
          // that happened in homebox_prepare_block
          $allowed_blocks[$block->module][$block->delta]['info'] = $block->subject;
        }
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ptsimard’s picture

Here is the patch

ptsimard’s picture

Status: Active » Needs review
ptsimard’s picture

Status: Needs review » Needs work

Hmm this only works when the block is actually displayed. My bad, I'll work more on this. It seems I need to change it around the when homebox_build does module_invoke($block['module'], 'block_info') instead.

ptsimard’s picture

Status: Needs work » Needs review
FileSize
1.13 KB

Ok this new patch now makes homebox_prepare_blocks() run on every block (not just displayed) and then force the subject rewrite.

I really believe this is a better behavior than to display the block_info administration label on the front end.

Please let me know if this works for you or if there is a better way.

Thanks

drumm’s picture

Status: Needs review » Closed (duplicate)
Parent issue: » #934986: Overwrite title issue