Skip to main content
added 92 characters in body; edited tags
Source Link
vintorg
  • 2k
  • 8
  • 34
  • 61

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.

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'
    );
}

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.

Source Link
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'
    );
}