Created
October 10, 2013 16:43
-
-
Save mrded/6921555 to your computer and use it in GitHub Desktop.
Split templates for entity by view_mode
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
<?php | |
/** | |
* Implements hook_preprocess_entity(). | |
*/ | |
function wj_profile_preprocess_entity(&$vars) { | |
switch ($vars['entity_type']) { | |
case 'profile2': | |
$vars['theme_hook_suggestions'][] = "profile2__profile__{$vars['view_mode']}"; | |
$function_name = "wj_profile_preprocess_profile2_profile_{$vars['view_mode']}"; | |
if (function_exists($function_name)) { | |
$function_name($vars); | |
} | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment