You are here

function _location_render in Location 5.3

Drupal 6 style theming helper.

5 calls to _location_render()
theme_location in ./location.d5.inc
theme_locations in ./location.d5.inc
theme_location_distance in ./location.d5.inc
theme_search_results_location in contrib/location_search/location_search.module
theme_search_result_location in contrib/location_search/location_search.module

File

./location.d5.inc, line 69
Drupal 5 specific routines.

Code

function _location_render($file, $variables, $module = 'location') {

  // Run the built-in template_preprocess function.
  $func = 'template_preprocess_' . $file;
  $func($variables);
  $filepath = drupal_get_path('module', 'location');
  if (file_exists(path_to_theme() . "/{$file}.tpl.php")) {
    $filepath = path_to_theme();
  }
  if (!empty($variables['template_files'])) {
    foreach ($variables['template_files'] as $temp) {
      if (file_exists(path_to_theme() . "/{$temp}.tpl.php")) {
        $filepath = path_to_theme();
        $file = $temp;
        break;
      }
      if (file_exists(drupal_get_path('module', $module) . "/{$temp}.tpl.php")) {
        $filepath = drupal_get_path('module', $module);
        $file = $temp;
        break;
      }
    }
  }
  extract($variables, EXTR_SKIP);

  // Extract the variables to a local namespace
  ob_start();

  // Start output buffering
  include "{$filepath}/{$file}.tpl.php";

  // Include the file
  $contents = ob_get_contents();

  // Get the contents of the buffer
  ob_end_clean();

  // End buffering and discard
  return $contents;

  // Return the contents
}