You are here

function _ds_extras_theme_registry_alter in Display Suite 7

Same name and namespace in other branches
  1. 7.2 modules/ds_extras/includes/ds_extras.registry.inc \_ds_extras_theme_registry_alter()

Implements hook_theme_registry_alter().

1 call to _ds_extras_theme_registry_alter()
ds_extras_theme_registry_alter in modules/ds_extras/ds_extras.module
Implements hook_theme_registry_alter().

File

modules/ds_extras/ds_extras.registry.inc, line 147
Display suite Extras registry file.

Code

function _ds_extras_theme_registry_alter(&$theme_registry) {

  // Add views preprocess layout.
  if (variable_get('ds_extras_vd', FALSE)) {
    $theme_registry['views_view']['preprocess functions'][] = 'ds_extras_preprocess_view_layout';
  }

  // Add process page function.
  if (variable_get('ds_extras_hide_page_title', FALSE)) {
    $theme_registry['page']['process functions'][] = 'ds_extras_process_page_title';
  }

  // Check on field templates.
  if (!variable_get('ds_extras_field_template', FALSE)) {
    $key = array_search('ds_preprocess_field', $theme_registry['field']['preprocess functions']);
    unset($theme_registry['field']['preprocess functions'][$key]);
  }

  // Inject ds_extras_render_panel_layout in all entity theming functions.
  if (variable_get('ds_extras_panel_view_modes')) {
    $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_extras_render_panel_layout';
        }
      }
    }

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