Isso adapta o padrão de tema Zen para funções de pré-processamento de nó a entidades:
<?php
/**
* Implements template_preprocess_entity().
*
* Runs a entity specific preprocess function, if it exists.
*/
function MYTHEME_preprocess_entity(&$variables, $hook) {
$function = __FUNCTION__ . '_' . $variables['entity_type'];
if (function_exists($function)) {
$function($variables, $hook);
}
}
/**
* Profile2 specific implementation of template_preprocess_entity().
*/
function MYTHEME_preprocess_entity_profile2(&$variables, $hook) {
}
/**
* Field Collection specific implementation of template_preprocess_entity().
*/
function MYTHEME_preprocess_entity_field_collection_item(&$variables, $hook) {
}