I have three taxonomy vocabularies which means that I have three bundles of the vocabulary entity type. I have a few view modes for them and one of them has to be available only to one of those vocabularies.

The method responsible for getting available view modes is \Drupal\Core\Entity\EntityManager::getAllDisplayModesByEntityType() but it does not distinct between bundles, only entity types.

Is there a way I can make that view mode restricted for that one particular vocabulary or this is just not possible?

  • I do not have an answer per-say, but how large of a data set are you looking at? Would it be too intensive to load all the entities returned by that method to find the taxonomy vocabularies you are looking for? – Brady Jul 16 '15 at 13:24

No, there is not. A view mode is not bundle-specific.

That hardly matters, because a view mode doesn't do anything unless you actually enable it and configure field formatters for it, resulting in a view display. If you don't then it just falls back to the default view display.

| improve this answer | |
  • The reason for my question is that that specific view mode make sense only for one for my vocabularies. I guess I'll have to rename it to something more generic then. Thanks. – user21641 Jul 17 '15 at 12:36

Your Answer

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