0

Assuming I have a number of entity bundles (e.g. node types) with a similar structure and behavior. Now I want to show a list of such entities/nodes. I want to use a view mode, e.g. "teaser", to display each node.

I could now configure the "teaser" view mode for all 4 node types, optionally with Display Suite. But the settings should be all the same.

So, which solutions do exist to have the same settings across entity bundles, and keep them synced?

Also, when exporting to a feature, I would prefer to avoid redundancy.

As far as I know, this is not currently possible with view modes in Drupal 7, due to how this feature works. But I am curious for out-of-the-box solutions that do the job.

Disclaimer: This is a question I repeatedly was asking myself in the past. At the time I am writing this, I already created a solution that works for me. I am posting this as a Q/A to share it with others. meta

0

Multiple solutions, pick what works best for you..

View modes

If you really want to work with view modes, there might be ways to copy the settings around between bundles. This still leaves you with lots of redundancy. So maybe not the preferable solution.

Views fields

If you work with Views, you can use views fields instead of view modes. These have their own advantages and drawbacks. You cannot use a layout (afaik). And now you cannot reuse the fields configuration across views.

So..

  • views fields: reuse across entity bundles, but not across views.
  • view modes: reuse across views, but not across entity bundles.

Ctools content panes / panels

Panels configurations can be reused in different places.

I personally do not use them as much, so I am sure someone else could write more about it.

Entity display plugin / Renderkit.

You can use EntDisP, to configure an entity display from multiple components. (This is using components from Renderkit.)

The module gives you a views row plugin, and a views field handler. So you can create an "entity display" for the entire row, or you can combine it with views fields.

It also gives you field formatters for entityreference, taxonomy term reference, paragraphs, and field collection.

You can configure the entity display in the place where you use it, so it will be stored as part of the view, field formatter, etc.

Or you can configure it as a "preset" with CFR Preset, so it will be stored independently and can be reused in different places. Such presets can be exported as features.

You can embed view modes in entity displays.

You can also embed entity displays in view modes using EntdispFieldUI.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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