[development] Block blocking

jeff at ayendesigns.com jeff at ayendesigns.com
Mon Jul 18 16:06:19 UTC 2011


Panels (or context) would be perfect, but most of their sites are complete and not using it, but I do have that in mind when the time comes to plan migration to D7 or D8. 

I like the unique region idea as something to try first...an added benefit being the assigning of the blocks can be automated and theme-independent. Thanks Earl! And everyone for good suggestions.
Ayen Designs - quality software the first time, every time!

-----Original Message-----
From: Earl Miles <merlin at logrus.com>
Sender: development-bounces at drupal.org
Date: Mon, 18 Jul 2011 08:57:42 
To: <development at drupal.org>
Reply-To: development at drupal.org
Subject: Re: [development] Block blocking

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