Skip to main content
1 of 2
vintorg
  • 2k
  • 8
  • 34
  • 61

Trouble enabling view modes for content types

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'
    );
}
vintorg
  • 2k
  • 8
  • 34
  • 61