CCK Blocks

The Problem

A project I have been working on recently required editors to be able to easily create blocks with several fields, choose which blocks they wanted on each page and in which order they wanted them in.

Reluctant as ever to give them access to the Blocks administration page, we decided we would have to rethink the way users interacted with blocks. 

As a side issue there was also a couple of fields that needed to be displayed somewhere outside of the node.tpl.php (in the same area as the sub nav for instance).

The Solution

Using the CCK blocks module we managed to find an easy solution to both of these issues. 

The idea behind this module is that you can choose to display any field as a block which can then be placed in to any region you like (you would then usually hide it in the node display).

With this new power we decided we would make a 'block' content type that the editors could easily create and edit, then we added a node reference field with multiple values to pages where editors could assign and rearrange these 'blocks' on a per-page basis. 

They will then be displayed in whichever region we (the admin user) choose for that field - users can then rearrange the order the 'blocks' appear but not change the region.

To make it all work we needed to hide the node reference field from the node display and enable it as a block - displaying rendered nodes.

This deceivingly needs to be done it two steps - the first is to enable a checkbox in the field settings form:

The second is to unhide the field in the CCK BLOCKS display under 'Manage display' for the content type and choose a display format (in our case we used 'Rendered node'):

This solves both our issues - easy peasy.