Drupal → Как выполнить свою preprocess функцию до основной
Задача — выполнить свою preprocess функцию mytheme_prepreprocess_views_view_field()
до template_preprocess_views_view_field()
:
/** * Implements hook_theme_registry_alter(). */ function MODULENAME_theme_registry_alter(&$theme_registry) { array_unshift($theme_registry['template_preprocess_views_view_field']['preprocess functions'], 'mytheme_prepreprocess_views_view_field'); } /** * Pre-preprocess function for theme_views_view_field(). */ function mytheme_prepreprocess_views_view_field(&$vars) { ... }
Реализовывать hook_theme_registry_alter()
желательно в модуле, а не в теме, потому что template.php не подгружается если например сброшен кэш из админки.
Оставить комментарий