CCK Blocks Display Mode settings

Retired - No Drupal 8 version will be released

cck_blocks has had a long and fruitful life, beginning in Drupal 5, back when fields on content types were a contrib module named CCK (Content Construction Kit).

Please use the more modern Field as Block module to replace your cck_blocks for Drupal 8.

Explanation: The code for cck_blocks is still very much based on the original 5.x code, modified for 6.x and then again for 7.x when CCK became part of core. The Drupal 7.x version was already doing things in an old fashioned way, and with the release of Drupal 8.0 it's time to say farewall and thank you to cck_blocks, after 8 years of faithful service.

Everything cck_blocks did, Field as Block does better, in a more modern way.

Field Visibility and Display Modes:

Since version 6.x-1.1 , the module does not hide the field in the node's content area anymore. You can do that for yourself in the display settings for your content type.

CCK blocks will define a display mode named "CCK Blocks", which you can use to configure the display of fields when they are appearing as blocks.

This allows you show the field both in the node's content area and in the CCK block, with different display settings.

IMPORTANT: Before any of your CCK blocks will show up, you need to set the field in question to be visible in the CCK blocks display mode! See "step by step", below.

Performance and Caching:

Since many users have experienced tremendous problems when block caching is activated (#400858: CCK Blocks appears to be incompatible with block caching), we decided to disable block caching for cck blocks.

If you wish to have block caching, please use the Block Cache Alter module to activate block caching for individual cck blocks.

Tokens

Block titles support tokens from the token module. You can make use of this to have a field as block, with another field value as the block title.

To do this you must download the contrib Token module for Drupal 7. The token module that comes in core will not provide the field tokens that you need.

Download and install the recommended release of Token. CCK Blocks requires Token 7.x-1.4 or newer.

For example, you can set your block title as follows:

[node:field_yourfieldname]

where "field_yourfieldname" matches the correct machine name of the field
containing the title you wish to use. You can find other tokens you may use by expanding the "REPLACEMENT PATTERNS" field group on the edit form.

Dependencies

The 6.x-version of CCK blocks depends on the CCK module.

You need the contrib Token module (in both Drupal 6 AND Drupal 7), if you want to use another field as your block title.

Installation

The usual - Download the module, place into your modules directory, and enable. There is no configuration page for the module, all configuration is done for each field (see "Step by Step" below).

Step by Step

These instructions were written for Drupal 7, but vary only slightly for Drupal 6.

For each field you wish to display in a block:

1. Admin - structure - content types - your content type - manage fields

2. Edit the field in question

3. At the bottom, under "field settings" you will find a new option:

Provide a block for this field : Disabled / Enabled

4. Set this to "Enabled" and then Save Settings

5. Now edit the display settings for your content type: Admin - structure - content types - your content type - manage display

6. You probably want to hide your CCK blocks field from the Default node display, otherwise it will show up twice on the page - in your block but also in the main content! To hide it from there, drag the field to the bottom so it is underneath "Hidden" and then hit Save.

7. Now Click on "CCK blocks". This display mode controls how content is rendered for CCK blocks only. By default your field will be hidden, which prevents it showing up. You need to at least change this!

8. Drag your field up from Hidden into the top area so it can be shown. Set a label (or set the label to None) and a format for the field when it appears in a block. (these do not have to be the same as in the main node content).

9. Hit Save to save the settings.

10. Visit the Drupal blocks page to enable and set the title for the block. admin - structure - blocks. Your block will be named: Field:
. Press "Edit" next to the field.

11. Set a title for the field. If you want to use a token, you must have the contrib Tokens module installed. (see "Tokens" above). If you want no title, use:

12. Now visit a node page that has the field set. You should see your field appear as a block!

Online Tutorials

For Drupal 7, see this CCK blocks for Drupal 7 tutorial.

For Drupal 6, see this Drupal 6 CCK blocks tutorial.

Related modules / Alternatives

If you are starting a new project, please consider using the new Field as Block module instead of cck_blocks. It is more modern, has a better user interface, and is going to be the upgrade path for cck_blocks beyond Drupal 7.

You can do everything CCK block does and a whole lot more using Display Suite (http://drupal.org/project/ds). See the "Region as Block" functionality inside the ds_extras module, or this short screencast on DS's Region to Block. If you are planning on using Display Suite already for other parts of your site, you should strongly consider using this feature instead of CCK Blocks.

If you want to have a field editable directly within a block, try editablefields.

You can also accomplish what CCK Blocks does using views 3 - by having a view with a contextual argument on Content:nid, providing a default value of the "Content ID from the URL".

Project Information

Downloads