5

I'm trying to understand how to create content for a site and place it somewhere. The two methods I want to compare are:

Content type

  • Create custom content type (with fields)
  • Create instances of content
  • Create view of this content type
  • Create block from view
  • Place block in region

Custom block type

  • Create Custom Block Type (with fields)
  • Create and place instance of custom block in region

Whats the pros and cons of each approach?

As an example scenario, lets say I have a home page with 4 sections of the same content type (for example product features). These 4 sections need to be ordered down the page. There will be other content on this page.

From what I have seen so far, the Custom Blocks require less effort up front to setup, I don't need a view, and I can arbitrarily order then in the block layout page (drag/drop). However, I feel like I've now 'hidden' content somewhere else that doesnt appear in the main content summary page, and a content manager would need to know to look there, also the default view to manage Custom blocks has less options than the content filter (i know you can add some filters to that view though). Also if I add each item as new instance of a custom block type to the block layout page, that list is going to start getting pretty long.

I guess adding the content as a content type means its created as node (and via the custom block type it isnt?)

Edit: The sites we build are big, and always multi language. This might affect any answers.

4 Answers 4

2

I think you should consider this question:

Does the content need to have its own url?

If yes, use nodes. Then you can click on a partial view (teaser) to get a full view of the content with its own url and you can put it in the menu, search for it and so on.

A block content is always only a part of a page, never a full view of its own and therefore has much less features.

1

In Drupal, content is made with nodes. Blocks are used to give more information that could be related to content (such as the nodes that are part of the same book the viewed node is part of, or the nodes that are in some other way related to the currently shown one), to the users (e.g. the last users who logged in, or the users who saw the current node), or to the site in general.

Drupal offers more feature for nodes, starting from the permissions associated to them. While for blocks a plain Drupal installation just has the administer blocks permission, which allows to create new blocks, but also delete the existing ones, for nodes a plain Drupal installation has permission for editing, deleting, viewing, and creating nodes.
Nodes have a more complex system to assign permissions to user for operations on nodes, which involves three hooks (hook_node_grants(), hook_node_records(), and hook_node_access()), while for blocks there is just a hook for that purpose.

You aren't forced to create a view for nodes, in the same way you aren't forced to create a block with a view. In both the cases, the Views module (which is now part of the Drupal core modules) helps you in making a list of entities. For example, when you enable the Views module in Drupal 8, there are some administrative pages that are served from a view, allowing the administrator users to extend those pages easily.

Also, for what I recall, you cannot add comments to blocks, but you can have comments for nodes. In a similar way, there are things that third-party modules implement for nodes, but not for blocks.

1

The information that you want on block/node. You should consider

  • If you want the information to be displayed in more than one place
  • If you want the information to be repositioned/placed easily within regions
  • If the information doesn't needs its own url / complex permission / query based logic

Then go for a block. Otherwise node. I would go for node for the main pages of my site and within those pages, i would use blocks if it needs to be.

Good luck :)

0

I would recommend "Content Type - Method" as it's saving the content as node. Saving it as a Node helps you to retrieve and reformat the content with list of Node API functions. Node Data can be efficiently accessed by different Core & Contributed modules like Views, Slider etc - most of the contributed module out there, are built around Nodes.

1
  • 3
    Thanks, when would you use a Custom Block then?
    – rje
    Mar 24, 2016 at 21:43

Your Answer

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

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