Contributions API

Calling all Drupal developers!

Help us get this on the first page of Digg. DIGG NOW!

Modules in 6

devel_themer_log

Definition

devel_themer_log()
contributions/devel/devel_themer.module, line 106

Description

Show all theme templates and functions that could have been used on this page.

Code

<?php
function devel_themer_log() {
  if (isset($GLOBALS['devel_theme_calls'])) {
    foreach ($GLOBALS['devel_theme_calls'] as $counter => $call) {
      $id = "devel_theme_log_link_$counter";
      $marker = "<div id=\"$id\" class=\"devel_theme_log_link\"></div>\n";

      $used = $call['used'];
      if ($call['type'] == 'func') {
        $name = $call['name']. '()';
        foreach ($call['candidates'] as $candidate) {
          foreach ($candidate as $item) {
            if ($item == $used) {
              $items[] = "<strong>$used</strong>";
            }
            else {
              $items[] = $item;
            }
          }
        }
      }
      else {
        $name = $call['name'];
        foreach ($call['candidates'] as $item) {
          if ($item == basename($used)) {
            $items[] = "<strong>$used</strong>";
          }
          else {
            $items[] = $item;
          }
        }
      }
      $rows[] = array($call['duration'], $marker. $name, implode(', ', $items));
      unset($items);
    }
    $header = array('Duration (ms)', 'Template/Function', "Candidate template files or function names");
    $output = theme('table', $header, $rows);
    return $output;
  }
}
?>