Working on a Drupal 7 site.
For a “view block” (or a series of view blocks) in the content section of a content type(s), when is it better to add a specific view block as field to the content type (and set as default view + hide), vs better to configuring the view block to display via the blocks section (and restricting via content type)?
Dot point:
- Add view a field to one or more content types (in content section)
-----Set as default and hide it (same view for all content type)
Or Set view to display in block section (or even context)?
- -----Restrict to content type
Pros and cons I can see:
Block displayed via as a field:
View is specific to the content type, no mistaking it
If view is used on one or more content types, the block and can be re-arranged without affecting other content types that might use it. Block display via blocks (or context) section
Can see at a glance which content types use the view block (if using context, otherwise, its harder)
Can’t have two content types have a different arrangements of the blocks (eg using two view blocks). Unless I’m wrong here?
Pollutes the blocks section of the backend if using many different content types (where are only used 1-2 times)
I can see this makes sense for side bar view or something since it would be used across the majority of the site + it’s not in the content section anyway, not for this though
Can someone advise which direction is better? (and if Drupal 8 way is different?)
print views_embed_view('view_name','block_1', $argument);
(and if Drupal 8 way is different?)
it's pretty much the same, except for template files method you will need to use the twig tweak module