You are here

README.txt in MultiBlock 6

Same filename and directory in other branches
  1. 8 README.txt
  2. 5 README.txt
  3. 7 README.txt
PROBLEM:
Drupal's block module is limited by the fact that a block can
only have one instance. Each block has a 1:1 relationship with
its region, weight, visibility (and other) settings. This means 
that it is impossible to have blocks in multiple regions or to
have blocks that have different settings on different pages.

SOLUTION:
multiblock module will keep track of multiple instances of blocks
and dispatch to their appropriate block hooks. Using this stratgey,
you would not enable any blocks that are implemented by other
modules. Instead, you will go to admin/build/block/instances and create
an "instance" of a block. Multiblock module will then implement this
block in its own block hook which will forward any hook_block calls
to the original module's hook. Using this method we can maintain
multiple instances of blocks with different settings but the same
implementation. This should not affect block-level caching. One
catch here is that the configure and save $op's for hook_block
are usually implemented to save only one set of data. This means
that for blocks that are unaware of multiblock you will only be
able to save CUSTOM data (this doesnt include visibility, weight,
region, etc.) for one set of data.

HOW TO USE IT:
1. Go to admin/build/block/instances
2. Select the type of block you want to create an instance of and
   type a unique title for that instance
3. Click "Add Instance"
4. Go to admin/build/block
5. Enable the block instance you have just created.

DEVELOPING MULTIBLOCK-ENABLED BLOCKS:
Multiblock should successfully clone any regular block created with
hook_block. However, if you clone a regular block that implements a
save or configure $op of hook_block, the custom block settings of
one block instance will overwrite the settings of another. To get
around this, you can make a block "multiblock enabled". To do this,
you have to first add an $op to your hook_block called 'mb_enabled'.
It should always return the string 'mb_enabled'. Once you do this,
the instances you create will get the block instance ID passed
in the $edit variable for the view, configure, and save $ops. This
will let you save and load different data to different instances
based on this instance ID. It is passed in with the
'multiblock_delta' key with the following format:
$edit['multiblock_delta'] = array(
          '#type' => 'value',
          '#value' => $block_id
      );

File

README.txt
View source
  1. PROBLEM:
  2. Drupal's block module is limited by the fact that a block can
  3. only have one instance. Each block has a 1:1 relationship with
  4. its region, weight, visibility (and other) settings. This means
  5. that it is impossible to have blocks in multiple regions or to
  6. have blocks that have different settings on different pages.
  7. SOLUTION:
  8. multiblock module will keep track of multiple instances of blocks
  9. and dispatch to their appropriate block hooks. Using this stratgey,
  10. you would not enable any blocks that are implemented by other
  11. modules. Instead, you will go to admin/build/block/instances and create
  12. an "instance" of a block. Multiblock module will then implement this
  13. block in its own block hook which will forward any hook_block calls
  14. to the original module's hook. Using this method we can maintain
  15. multiple instances of blocks with different settings but the same
  16. implementation. This should not affect block-level caching. One
  17. catch here is that the configure and save $op's for hook_block
  18. are usually implemented to save only one set of data. This means
  19. that for blocks that are unaware of multiblock you will only be
  20. able to save CUSTOM data (this doesnt include visibility, weight,
  21. region, etc.) for one set of data.
  22. HOW TO USE IT:
  23. 1. Go to admin/build/block/instances
  24. 2. Select the type of block you want to create an instance of and
  25. type a unique title for that instance
  26. 3. Click "Add Instance"
  27. 4. Go to admin/build/block
  28. 5. Enable the block instance you have just created.
  29. DEVELOPING MULTIBLOCK-ENABLED BLOCKS:
  30. Multiblock should successfully clone any regular block created with
  31. hook_block. However, if you clone a regular block that implements a
  32. save or configure $op of hook_block, the custom block settings of
  33. one block instance will overwrite the settings of another. To get
  34. around this, you can make a block "multiblock enabled". To do this,
  35. you have to first add an $op to your hook_block called 'mb_enabled'.
  36. It should always return the string 'mb_enabled'. Once you do this,
  37. the instances you create will get the block instance ID passed
  38. in the $edit variable for the view, configure, and save $ops. This
  39. will let you save and load different data to different instances
  40. based on this instance ID. It is passed in with the
  41. 'multiblock_delta' key with the following format:
  42. $edit['multiblock_delta'] = array(
  43. '#type' => 'value',
  44. '#value' => $block_id
  45. );