This project is not covered by Drupal’s security advisory policy.

This module provides an alternate way to manage blocks. If you have many blocks that are displayed in different configurations across your site's pages, managing them through the standard blocks admin interface can be tedious. For example, say you decide you want to add six blocks to three different pages based on request URI and four blocks (including two of the original six) to three other pages based on node type. This quickly becomes a frustrating exercise as you think through writing logic per block that will handle the overlap correctly. Block Assign simply provides another approach to organizing blocks.

Please be very sure to read the release notes before installing. They warn of (intentional) potential data loss as a result of configuring the module.

Usage

  1. Enable the module in your site admin.
  2. Go to blocks admin and configure a block.
  3. Warning: Saving this block will update all of your blocks to cause them to use the block_assign feature; this will overwrite any PHP code you have set to be evaluated to determine block visibility.
  4. Go to /admin/settings/block_assign (or click the "Page Visibility" tab the module adds to your block administration).
  5. You'll see here a list of blocks that are enabled. Select the ones that you wish to display for a given set of pages.
  6. In the next section of the form, you specify criteria that the block should try to match on. By default, "uri" and "node id" are available. Provide a regular expression (e.g. "^\/blog") in the uri field or an integer representing a node id in the node field. If you have the globalnode module enabled, you additionally get a "type" field that lets you specify e.g. "blog" to apply the block to all nodes of type blog. (For this to work, you of course have to follow instructions for setting up the globalnode module.)

How it Works

The idea is that rather than being block-oriented, the organization of blocks should be content-oriented. In my case, at least, it's easier to think "what blocks would I like to show on this page or node type" than to think "what pages or node types would I like to show this block on".

The module lets you assign multiple blocks at once to pages or node types. The result can be much more efficient block management. Using Block Assign, you can select many blocks and assign to the URI /blog in one step rather than having to edit each block separately to specify the content to associate it with.

Project information

Releases