[development] Block blocking

Bob Hutchinson hutchlists at midwales.com
Mon Jul 18 15:53:08 UTC 2011

On Monday 18 July 2011, 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.

You could try manipulating the blocks table to suit your needs....

Bob Hutchinson
Midwales dot com

More information about the development mailing list