function _ds_theme_registry_alter in Display Suite 7.2
Same name and namespace in other branches
- 7 ds.registry.inc \_ds_theme_registry_alter()
Implements hook_theme_registry_alter().
1 call to _ds_theme_registry_alter()
- ds_theme_registry_alter in ./
ds.module - Implements hook_theme_registry_alter().
File
- includes/
ds.registry.inc, line 266 - Registry file for Display Suite.
Code
function _ds_theme_registry_alter(&$theme_registry) {
// Inject ds_entity_variables in all entity theming functions.
$entity_info = entity_get_info();
foreach ($entity_info as $entity => $info) {
if (isset($entity_info[$entity]['fieldable']) && $entity_info[$entity]['fieldable']) {
// User uses user_profile for theming.
if ($entity == 'user') {
$entity = 'user_profile';
}
// Only add preprocess functions if entity exposes theme function.
if (isset($theme_registry[$entity])) {
$theme_registry[$entity]['preprocess functions'][] = 'ds_entity_variables';
}
}
}
// Support for File Entity.
if (isset($theme_registry['file_entity'])) {
$theme_registry['file_entity']['preprocess functions'][] = 'ds_entity_variables';
}
// Support for Entity API.
if (isset($theme_registry['entity'])) {
$theme_registry['entity']['preprocess functions'][] = 'ds_entity_variables';
}
}