You are here

README.txt in Content Construction Kit (CCK) 6.3

Same filename in this branch
  1. 6.3 README.txt
  2. 6.3 modules/content_multigroup/README.txt
Same filename and directory in other branches
  1. 6.2 modules/content_multigroup/README.txt
CONTENTS OF THIS FILE
=====================
- USING MULTIGROUPS
- FIELDS AND WIDGETS THAT WORK IN MULTIGROUPS
- VIEWS INTEGRATION
- TROUBLESHOOTING


USING MULTIGROUPS
=================

The Multigroup group treats all included fields like a single field, keeping
the related delta values of all included fields synchronized.

To use a Multigroup, create a new group, make it the 'Multigroup' type, set
the number of multiple values for all the fields in the Multigroup, and drag
into it the fields that should be included.

All fields in the Multigroup will automatically get the group setting for
multiple values. On the node form, the group is rearranged to keep the delta
values for each field in a single drag 'n drop group, by transposing the
normal array(group_name => field_name => delta => value) into
array(group_name => delta => field_name => value).

During validation and submission, the field values are restored to their
normal positions.


FIELDS AND WIDGETS THAT WORK IN MULTIGROUPS
===========================================

All fields that allow the Content module to handle their multiple values should
work here. Fields that handle their own multiple values will not be allowed
into Multigroups unless they implement hook_content_multigroup_allowed_widgets()
to add their widgets to the allowed widget list. Example:

  

  function MODULE_content_multigroup_allowed_widgets() {
    return array('WIDGET_NAME_1', 'WIDGET_NAME_2', ...);
  }
  
All fields that allow the Content module to handle their multiple values should work correctly when a field placed on a Multigroup is moved off, to a normal field group, or to the top level of the form. Fields that handle their own multiple values which may store different results in Multigroup and standard groups should implement hook_content_multigroup_no_remove_widgets() to add their widgets to the list of widgets that cannot be removed from Multigroups. Example:

  function MODULE_content_multigroup_no_remove_widgets() {
    return array('WIDGET_NAME_1', 'WIDGET_NAME_2', ...);
  }
  
The Content Taxonomy module [1] is an example where it implements the previous hooks for a few widgets. [1] http://drupal.org/project/content_taxonomy If a simple array of widgets is not sufficient to test whether this action will work, modules can implement hook_content_multigroup_allowed_in() and hook_content_multigroup_allowed_out() to intervene. Both hooks should return an array as in the following example:
function MODULE_content_multigroup_allowed_in() {
  return array(
    'allowed' => FALSE,
    'message' => t('This change is not allowed. Reason here...'),
  );
}
Custom code and modules that add fields to groups outside of the UI should use content_multigroup_allowed_in() and content_multigroup_allowed_out() to test whether fields are allowed in or out of a Multigroup. These functions can be located in content_multigroup.admin.inc. VIEWS INTEGRATION ================= For each multigroup, there is a new filter under "Content multigroup" category in Views that provides a method to synchronize fields by delta. TROUBLESHOOTING =============== The most likely cause of problems with field modules not working in multigroup is if they wipe out #element_validate with their own validation functions, or they hard-code assumptions into submit or validation processes that the form is structured in the usual field => delta => value order instead of allowing for the possibility of a different structure. See Nodereference for an example of a field that handles validation without making assumptions about the form structure.

File

modules/content_multigroup/README.txt
View source
  1. CONTENTS OF THIS FILE
  2. =====================
  3. - USING MULTIGROUPS
  4. - FIELDS AND WIDGETS THAT WORK IN MULTIGROUPS
  5. - VIEWS INTEGRATION
  6. - TROUBLESHOOTING
  7. USING MULTIGROUPS
  8. =================
  9. The Multigroup group treats all included fields like a single field, keeping
  10. the related delta values of all included fields synchronized.
  11. To use a Multigroup, create a new group, make it the 'Multigroup' type, set
  12. the number of multiple values for all the fields in the Multigroup, and drag
  13. into it the fields that should be included.
  14. All fields in the Multigroup will automatically get the group setting for
  15. multiple values. On the node form, the group is rearranged to keep the delta
  16. values for each field in a single drag 'n drop group, by transposing the
  17. normal array(group_name => field_name => delta => value) into
  18. array(group_name => delta => field_name => value).
  19. During validation and submission, the field values are restored to their
  20. normal positions.
  21. FIELDS AND WIDGETS THAT WORK IN MULTIGROUPS
  22. ===========================================
  23. All fields that allow the Content module to handle their multiple values should
  24. work here. Fields that handle their own multiple values will not be allowed
  25. into Multigroups unless they implement hook_content_multigroup_allowed_widgets()
  26. to add their widgets to the allowed widget list. Example:
  27. @code
  28. function MODULE_content_multigroup_allowed_widgets() {
  29. return array('WIDGET_NAME_1', 'WIDGET_NAME_2', ...);
  30. }
  31. @endcode
  32. All fields that allow the Content module to handle their multiple values
  33. should work correctly when a field placed on a Multigroup is moved off, to a
  34. normal field group, or to the top level of the form. Fields that handle their
  35. own multiple values which may store different results in Multigroup and
  36. standard groups should implement hook_content_multigroup_no_remove_widgets()
  37. to add their widgets to the list of widgets that cannot be removed from
  38. Multigroups. Example:
  39. @code
  40. function MODULE_content_multigroup_no_remove_widgets() {
  41. return array('WIDGET_NAME_1', 'WIDGET_NAME_2', ...);
  42. }
  43. @endcode
  44. The Content Taxonomy module [1] is an example where it implements the previous
  45. hooks for a few widgets.
  46. [1] http://drupal.org/project/content_taxonomy
  47. If a simple array of widgets is not sufficient to test whether this action
  48. will work, modules can implement hook_content_multigroup_allowed_in()
  49. and hook_content_multigroup_allowed_out() to intervene. Both hooks should
  50. return an array as in the following example:
  51. @code
  52. function MODULE_content_multigroup_allowed_in() {
  53. return array(
  54. 'allowed' => FALSE,
  55. 'message' => t('This change is not allowed. Reason here...'),
  56. );
  57. }
  58. @endcode
  59. Custom code and modules that add fields to groups outside of the UI should
  60. use content_multigroup_allowed_in() and content_multigroup_allowed_out() to
  61. test whether fields are allowed in or out of a Multigroup. These functions
  62. can be located in content_multigroup.admin.inc.
  63. VIEWS INTEGRATION
  64. =================
  65. For each multigroup, there is a new filter under "Content multigroup" category
  66. in Views that provides a method to synchronize fields by delta.
  67. TROUBLESHOOTING
  68. ===============
  69. The most likely cause of problems with field modules not working in multigroup
  70. is if they wipe out #element_validate with their own validation functions, or
  71. they hard-code assumptions into submit or validation processes that the form
  72. is structured in the usual field => delta => value order instead of allowing
  73. for the possibility of a different structure. See Nodereference for an example
  74. of a field that handles validation without making assumptions about the form
  75. structure.