You are here

function views_plugin_display::format_themes in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 6.2 plugins/views_plugin_display.inc \views_plugin_display::format_themes()
  2. 7.3 plugins/views_plugin_display.inc \views_plugin_display::format_themes()

Format a list of theme templates for output by the theme info helper.

1 call to views_plugin_display::format_themes()
views_plugin_display::options_form in plugins/views_plugin_display.inc
Provide the default form for setting options.

File

plugins/views_plugin_display.inc, line 1941
Contains the base display plugin.

Class

views_plugin_display
The default display plugin handler. Display plugins handle options and basic mechanisms for different output methods.

Code

function format_themes($themes) {
  $registry = theme_get_registry();

  // Run through the theme engine variables, if necessary
  global $theme_engine;
  $extension = '.tpl.php';
  if (isset($theme_engine)) {
    $extension_function = $theme_engine . '_extension';
    if (function_exists($extension_function)) {
      $extension = $extension_function();
    }
  }
  $output = '';
  $picked = FALSE;
  foreach ($themes as $theme) {
    $template = strtr($theme, '_', '-') . $extension;
    if (!$picked && !empty($registry[$theme])) {
      $template_path = isset($registry[$theme]['path']) ? $registry[$theme]['path'] . '/' : './';
      if (file_exists($template_path . $template)) {
        $hint = t('File found in folder @template-path', array(
          '@template-path' => $template_path,
        ));
        $template = '<strong title="' . $hint . '">' . $template . '</strong>';
      }
      else {
        $template = '<strong class="error">' . $template . ' ' . t('(File not found, in folder @template-path)', array(
          '@template-path' => $template_path,
        )) . '</strong>';
      }
      $picked = TRUE;
    }
    $fixed[] = $template;
  }
  return implode(', ', array_reverse($fixed));
}