Created
January 13, 2014 17:56
-
-
Save mglaman/8404838 to your computer and use it in GitHub Desktop.
Simple Drupal module to add display view modes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name = Custom Entity Display Modes | |
| description = Adds additional display modes | |
| core = 7.x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Implements hook_entity_info_alter(). | |
| * | |
| * Adds a new order view mode | |
| */ | |
| function mymodule_view_modes_entity_info_alter(&$entity_info) { | |
| $entity_info['node']['view modes']['custom'] = array( | |
| 'label' => t('Custom Display'), | |
| 'custom settings' => FALSE, | |
| ); | |
| } | |
| function mymodule_view_modes_preprocess_node(&$vars) { | |
| if ($vars['node']->type == 'node_type' && $vars['view_mode'] == 'custom') { | |
| $vars['theme_hook_suggestions'][] = 'node__node_type__custom'; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment