5

I have three blocks A, B and C and I need to embed the blocks A and B into the template of a block C. Is it possible?

2
  • I am just curious, why would you do this? So that you could move two other block around seamlessly by using one block as a container, or 'basket'?
    – blue928
    Feb 18, 2012 at 9:54
  • My idea is that two blocks are in the same space that one block in the right column. I thought in blocks embed.
    – cabita
    Feb 18, 2012 at 11:58

3 Answers 3

7

Yes, when you create a block programatically you can add any content inclusive another blocks.

In your block function you can do something like:

$blockA = module_invoke('block', 'block_view', 1);
$blockB = module_invoke('block', 'block_view', 2);
return $blockA['content'].$blockB['content'];
1
  • hello Gnuget - many thx for the great answer. This is convincing me. I love your solution! Greetings
    – zero
    Feb 17, 2012 at 22:40
3

Alternately, create a View that contains A, B, and C in some combination, and expose it as a block.

1

I believe you can embed several blocks within another mini-panel block, with the Panels module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.