Renderer Per Node - alternative filefield displays on one page

Experimental project

This is a sandbox project, which contains experimental code for developer use only.

Allow editors to choose different rendering options on a per-node basis.

This allows you to add an extra select box to a content type, and then use that as a modifier that controls the rendering of another field.

Prime use-case is to select different sizes from imagecache to use on filefield images to control how a mini-gallery is displayed.

animated examples

Setup

  • Enable the module as usual through module administration.
  • Create or edit your content type and add the field you want to modify - such as an imagefield named 'field_image'. This is the target field.
    Whatever renderer you have set in the normal "Display fields" will remain the default unless overridden.
  • Edit this content type and add a new field that will operate as the modifier.
    This is a type of text field, and the widget to select will be Renderer chooser
  • Name it 'field_image_renderer' or similar. Position it near the target field. Save.
  • In the field settings you will see the "Target field" selector. Use it.
  • By default, all formatter options are available at first, but if you are using imagecache that can provide way too many.
    When editing the field settings (after saving once) you can select a subset of formatters that will be available to editors.

From now on, when editing nodes of that content type, this additional selector can be used to modify how the target field is displayed.

Things

Only the 'full' node view is affected. This utility does not modify teasers. It does not interact with views, which provides its own formatter selectors.

You can have more than one modifier+target pair in a content type if you really want.

There is no reason why this can't be used on any CCK field, not just images. Try it on nodereferences.

Some nice renderers to swap between are available. For the demo I used :

* http://drupal.org/project/imagecache
* http://drupal.org/project/galleryformatter
* A localized copy of something similar to http://drupal.org/project/image_composition

Related

@see Formatter field for a similar one in D7.
@see Field_weight for field weight per node.

Project information