I have a custom view mode and need to enable it for a node type. I need to enable it through my module, and it seemed like hook_entity_info_alter() is the way to go, but it's not working. Am I missing something?

My code:

function mymod_entity_info_alter(&$entity_info) {
    $entity_info['node']['view modes']['vm_mid_box'] = array(
        'custom settings' => TRUE,
        'label' => 'Mid Box'

EDIT: I create the displays in Display Suite, and am using the export data dumped into DS hooks.

  • Have you cleared the cache? And I have found in the past that when I do this I must first navigate after clearing the cache to the entity type's display page. Aug 18, 2014 at 4:30
  • I do, obsessively.
    – vintorg
    Aug 18, 2014 at 4:45

1 Answer 1


Late answer, but for anyone else looking, to get your view mode to display try either visiting the module page or disabling then re-enabling your module. Afterwards clear the cache.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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