[development] Block blocking

Earl Miles merlin at logrus.com
Mon Jul 18 15:57:42 UTC 2011

On 7/18/2011 8:00 AM, jeff at ayendesigns.com wrote:
> Here's an interesting one. If I have a special purpose page, and only
> want certain blocks to appear on that page, I can, of course, go to the
> blocks UI and change every other block to not appear on that page,
> either by naming it (where the list is pages NOT to appear on) or
> listing all the others (pages TO appear on).
> I find the need to do this from a module, AND not knowing what the other
> blocks are. This module will be used on several sites that the client
> has. When this page is requested, the blocks that the module defines
> will be displayed, but ANY OTHER BLOCK that would, by default, appear on
> the page needs to be prevented from doing so. How would I do this
> completely from code?
> I'm assuming that I'm looking for a structure that contains all the
> blocks that will be passed to the page much like form fields in $form,
> so that I can just loop and mark them as hidden.

Use the no blocks function of theme('page') to prevent blocks and print
the regions yourself? Use a panel or panels everywhere? Use context.module?

Create a completely different page.tpl.php with different regions and
then place only that module's blocks in those regions? Then the regular
regions won't get printed?

Have that page appear in a different theme; that theme has separate
block UI and so that theme could configure only the needed blocks.

More information about the development mailing list