You are here

function custom_formatters_theme_registry_alter in Custom Formatters 7.2

Implements hook_theme_registry_alter().

Copied and modified from ds/includes/ds.registry.inc#263

File

includes/ds.inc, line 13
Display Suite module integration.

Code

function custom_formatters_theme_registry_alter(&$theme_registry) {

  // Inject custom_formatters_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'][] = 'custom_formatters_ds_entity_variables';
      }
    }
  }

  // Support for File Entity.
  if (isset($theme_registry['file_entity'])) {
    $theme_registry['file_entity']['preprocess functions'][] = 'custom_formatters_ds_entity_variables';
  }

  // Support for Entity API.
  if (isset($theme_registry['entity'])) {
    $theme_registry['entity']['preprocess functions'][] = 'custom_formatters_ds_entity_variables';
  }
}