You are here

function vud_pseudo_theming in Vote Up/Down 6.2

Same name and namespace in other branches
  1. 6.3 vud.theme.inc \vud_pseudo_theming()
  2. 7.2 vud.theme.inc \vud_pseudo_theming()
  3. 7 vud.theme.inc \vud_pseudo_theming()

Mimic some theming workflow.

We do this since we do not have standard theme overwrite because is not possible to decide dinamically the path where the template is located(in contrast with function names and template names).

2 calls to vud_pseudo_theming()
vud_votes_proxy in ./vud.theme.inc
Proxy votes display function, that hook_theme() calls.
vud_widget_proxy in ./vud.theme.inc
Proxy widget function that hook_theme() calls.

File

./vud.theme.inc, line 92
Theme functions

Code

function vud_pseudo_theming($vote_entity, $template_type, $plugin, &$variables) {

  // let modules modify variables passed to the template
  $variables_type = 'vud_' . $template_type . '_template_variables';
  drupal_alter($variables_type, $variables);

  // and then provide template suggestions by hand
  $suggestions = module_invoke('vud_' . $vote_entity, 'template_suggestions', $template_type, $plugin, $variables['content_id']);
  if (empty($suggestions)) {
    $template_file = $plugin['path'] . '/' . $plugin[$template_type . ' template'] . $plugin['extension'];
  }
  else {
    global $theme_key;
    $themes = list_themes();
    $current_theme = $themes[$theme_key];
    $paths = array(
      $plugin['path'],
      dirname($current_theme->filename),
    );
    $template_file = drupal_discover_template($paths, $suggestions, $plugin['extension']);
  }
  return $template_file;
}