답변:
이것은 노드 사전 프로세스 기능에 대한 Zen 테마 패턴을 엔티티에 적용합니다.
<?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) {
}