0

I am looking for a recommended approach for a customization in Drupal I am building.

The desired workflow: A user will be able to attach N number of custom content sections (CCS) to a node. A user will be able to select the type of CCS (see example below), customize it, and arrange it's order amongst all other CCSs attached to a specific node.

Example CCS: Enter in the URLs for several Flikr images and the site outputs this as a nice gallery.

I know how to build the individual functionality for each CCS, but I'm wondering if there is any approach you would recommend for the broader functionality.

4 Answers 4

0

looks like you need to use comments module for it, you will modify comments by adding more fields to it (for rating etc), then you can attach unlimited such content to your node. if you're in D6 you need to convert your comments to node (using some module) and then add more fields to it by CCK, and if you're using D7 you can attach fields directly (i guess - b/c its entity now)

0

Another solution in D7 would be to add textarea field to your node and enable unlimited values to it, in this way your node's field will hold multiple unlimited instances of your text/section. May be you might need to create your own field type to add a rating dimension to it (b/c you also want to sort the content section)

0

Looks like the answer was the excellent Field Collection module for D7. This let me create a collection of fields that could be repeated (like one collection is a title (text, x1) and image (file, n times).

You assign the fields in the collection to have the limits you want (only 1, unlimited, etc), and then you assign the collection to the content type, can you can define how many collections can be attached.

0

1. Option: Paragraphs

Check out Paragraphs module.

Instead of putting all your content in one WYSIWYG body field, your content will exist of a paragraph field containing multiple paragraph items. Paragraph items can contain multiple fields and have different types of field sets(bundles),

You create a few paragraphs bundles with fields, and then add one paragraphs field to the page content type.

2. Option: Nestedbox + Inline entity form + Entity reference

An alternative to Paragraphs is Nestedbox in combination with Inline entity form. There is an issue discussing the differences to Paragraphs.

Nestedbox itself just defines an entity type. You could use regular nodes or any other entity type instead. but the benefit of nestedbox is that this entity type has no other side effects.

3. Option: Bean + Inline entity form + Entity reference.

Instead of the nestedbox entity type, some people might prefer Bean for the entity type. The downside is that every bean is also a block, so it would spam the form at admin/structure/block.

The benefit is that you can reuse the same bundles definitions.

Common techniques with all these options

Field types that are very useful in paragraphs / nestedbox (besides the basic field types):

  • Block reference to embed blocks.
  • View reference to embed views displays.
  • The paragraphs field type itself, which allows you to embed paragraphs within a paragraph. E.g. for a multi column layout.
  • Or instead, the entityreference field type, allowing you to embed nestedbox entites within a nestedbox entity.

For the paragraphs or nestedbox display you can use Display suite. You can create custom layouts to achieve e.g. multi-column sections. Field formatters are also a thing you should play with. And Field templates are awesome.

You can export paragraphs and nestedbox and bean bundles with Features, so you can reuse them on another site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.