You are here

README.txt in CCK Blocks 7

CCK Blocks module for Drupal 7
------------------------------

This module allows you to create blocks from fields of the currently 
displayed node.  It is very handy as a simple way to get fields
appearing in a block, instead of in the main content region.

This makes it possible to show the field's value of the currently
shown node in the block (placed left, right or in whatever region)
instead of (or next to) the node's main content area. 

Site users can add node-related block-content right from the 
node's editing page.


Examples of use:
----------------

- Adding a simple sideblock to a node form, containing Field
data.  e.g.:  A "short bio" block" (Long Text field), an
"Attached Files" block (file field), an "Icon" block (media field). 
You can use any Field type in Drupal, including fields 
provided by contrib modules!

- Giving content types a "sideblock" Long text field, with
another text field named "sideblock title" controlling the title,
so users can set their own sidebar content and title.


Field Visibility and Display Modes: 
-----------------------------------

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.
http://drupal.org/project/blockcache_alter


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.

========================================================================
IMPORTANT:  Since Token 7.x-1.2 you will need a patch to the Token
and also the latest 7.x-1.x-dev version of CCK_Blocks in order to use or
edit existing tokenized node titles.  If your node titles used to work
but no longer edit, this is probably why.

Please upgrade your token to the latest 7.x-1.x-dev version, and then
apply the patch from from issue: http://drupal.org/node/1863910:
http://drupal.org/files/token-1863910-overwriting-token-types-1.patch

Also make sure you have 7.x-1.x-dev of CCK_Blocks.
========================================================================

Enable Token, then 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 more replacement
values to use under "Node" in the list of Replacement Patterns below
the block fields.


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:
-------------

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:  <the field name>.  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: <none>

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

Online Tutorial:
----------------

At the time of this writing, an excellent tutorial on CCK blocks for Drupal 7
could be found here: http://www.ostraining.com/blog/drupal/cck-blocks/


Related modules:
----------------

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

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. If you are planning on using Display Suite 
already, you should strongly consider using its Region as Block instead
of CCK blocks!

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

File

README.txt
View source
  1. CCK Blocks module for Drupal 7
  2. ------------------------------
  3. This module allows you to create blocks from fields of the currently
  4. displayed node. It is very handy as a simple way to get fields
  5. appearing in a block, instead of in the main content region.
  6. This makes it possible to show the field's value of the currently
  7. shown node in the block (placed left, right or in whatever region)
  8. instead of (or next to) the node's main content area.
  9. Site users can add node-related block-content right from the
  10. node's editing page.
  11. Examples of use:
  12. ----------------
  13. - Adding a simple sideblock to a node form, containing Field
  14. data. e.g.: A "short bio" block" (Long Text field), an
  15. "Attached Files" block (file field), an "Icon" block (media field).
  16. You can use any Field type in Drupal, including fields
  17. provided by contrib modules!
  18. - Giving content types a "sideblock" Long text field, with
  19. another text field named "sideblock title" controlling the title,
  20. so users can set their own sidebar content and title.
  21. Field Visibility and Display Modes:
  22. -----------------------------------
  23. The module does not hide the field in the node's content area anymore.
  24. You can do that for yourself in the display settings for your content type.
  25. CCK blocks will define a display mode named "CCK Blocks", which you can
  26. use to configure the display of fields when they are appearing as blocks.
  27. This allows you show the field both in the node's content area and in
  28. the CCK block, with different display settings.
  29. IMPORTANT: Before any of your CCK blocks will show up, you need to set
  30. the field in question to be visible in the CCK blocks display mode!
  31. See "step by step", below.
  32. Performance and Caching:
  33. ------------------------
  34. Since many users have experienced tremendous problems when block caching is
  35. activated (#400858: CCK Blocks appears to be incompatible with block caching),
  36. we decided to disable block caching for cck blocks.
  37. If you wish to have block caching, please use the Block Cache Alter module
  38. to activate block caching for individual cck blocks.
  39. http://drupal.org/project/blockcache_alter
  40. Tokens:
  41. -------
  42. Block titles support tokens from the token module. You can make use of this
  43. to have a field as block, with another field value as the block title.
  44. To do this you must download the contrib Token module for Drupal 7. The token
  45. module that comes in core will not provide the field tokens that you need.
  46. ========================================================================
  47. IMPORTANT: Since Token 7.x-1.2 you will need a patch to the Token
  48. and also the latest 7.x-1.x-dev version of CCK_Blocks in order to use or
  49. edit existing tokenized node titles. If your node titles used to work
  50. but no longer edit, this is probably why.
  51. Please upgrade your token to the latest 7.x-1.x-dev version, and then
  52. apply the patch from from issue: http://drupal.org/node/1863910:
  53. http://drupal.org/files/token-1863910-overwriting-token-types-1.patch
  54. Also make sure you have 7.x-1.x-dev of CCK_Blocks.
  55. ========================================================================
  56. Enable Token, then set your block title as follows:
  57. [node:field_yourfieldname]
  58. where "field_yourfieldname" matches the correct machine name of the field
  59. containing the title you wish to use. You can find more replacement
  60. values to use under "Node" in the list of Replacement Patterns below
  61. the block fields.
  62. Installation:
  63. -------------
  64. The usual - Download the module, place into your modules directory, and
  65. enable. There is no configuration page for the module, all configuration
  66. is done for each field (see "Step by Step" below).
  67. Step by Step:
  68. -------------
  69. For each field you wish to display in a block:
  70. 1. Admin - structure - content types - your content type - manage fields
  71. 2. Edit the field in question
  72. 3. At the bottom, under "field settings" you will find a new option:
  73. Provide a block for this field : Disabled / Enabled
  74. 4. Set this to "Enabled" and then Save Settings
  75. 5. Now edit the display settings for your content type:
  76. Admin - structure - content types - your content type - manage display
  77. 6. You probably want to hide your CCK blocks field from the Default node
  78. display, otherwise it will show up twice on the page - in your block
  79. but also in the main content! To hide it from there, drag the field
  80. to the bottom so it is underneath "Hidden" and then hit Save.
  81. 7. Now Click on "CCK blocks". This display mode controls how content
  82. is rendered for CCK blocks only. By default your field will be hidden,
  83. which prevents it showing up. You need to at least change this!
  84. 8. Drag your field up from Hidden into the top area so it can be shown.
  85. Set a label (or set the label to None) and a format for the field
  86. when it appears in a block. (these do not have to be the same as
  87. in the main node content).
  88. 9. Hit Save to save the settings.
  89. 10. Visit the Drupal blocks page to enable and set the title for the block.
  90. admin - structure - blocks. Your block will be named:
  91. Field: . Press "Edit" next to the field.
  92. 11. Set a title for the field. If you want to use a token, you must have
  93. the contrib Tokens module installed. (see "Tokens" above).
  94. If you want no title, use:
  95. 12. Now visit a node page that has the field set. You should see your
  96. field appear as a block!
  97. Online Tutorial:
  98. ----------------
  99. At the time of this writing, an excellent tutorial on CCK blocks for Drupal 7
  100. could be found here: http://www.ostraining.com/blog/drupal/cck-blocks/
  101. Related modules:
  102. ----------------
  103. If you want to have a field editable directly within a block, try editablefields.
  104. You can do everything CCK block does and a whole lot more using Display Suite
  105. (http://drupal.org/project/ds). See the "Region as Block" functionality
  106. inside the ds_extras module. If you are planning on using Display Suite
  107. already, you should strongly consider using its Region as Block instead
  108. of CCK blocks!
  109. You can also accomplish what CCK Blocks does using views - by having a view
  110. with a contextual argument on Content:nid, providing a default value of the
  111. "Content ID from the URL".