Skip to content

Instantly share code, notes, and snippets.

View uberEllis's full-sized avatar

André Ellis uberEllis

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

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) {