Skip to content

Instantly share code, notes, and snippets.

Avatar

André Ellis uberEllis

View GitHub Profile
@swichers
swichers / d7-add-entity-view-mode.md
Last active Oct 18, 2019
Drupal 7 - Programmatically add view mode to entity
View d7-add-entity-view-mode.md

In a module file:

This will enable an additional view mode for use on the specified entity type(s). Many examples will show the custom settings here being set to TRUE. If TRUE is used then that view mode is added to all entities of the specified type regardless of if it should be on the bundle or not.

/**
 * Implements hook_entity_info_alter().
 */
function HOOK_entity_info_alter(&$entity_info) {
You can’t perform that action at this time.