Same name and namespace in other branches
  1. 6.x-3.x views.module \views_debug()

Provide debug output for Views.

This relies on devel.module or on the debug() function if you use a simpletest.

Parameters

mixed $message: The message/variable which should be debugged. This either could be

  • an array/object which is converted to pretty output
  • a translation source string which is used together with the parameter placeholders.

array $placeholders: The placeholders which are used for the translation source string.

1 call to views_debug()
vpr in ./views.module
Shortcut to views_debug().

File

./views.module, line 1852
Primarily Drupal hooks and global API functions to manipulate views.

Code

function views_debug($message, $placeholders = array()) {
  if (!is_string($message)) {
    $output = '<pre>' . var_export($message, TRUE) . '</pre>';
  }
  if (module_exists('devel') && variable_get('views_devel_output', FALSE) && user_access('access devel information')) {
    $devel_region = variable_get('views_devel_region', 'footer');
    if ($devel_region == 'watchdog') {
      $output = $message;
      watchdog('views_logging', $output, $placeholders);
    }
    elseif ($devel_region == 'drupal_debug') {
      $output = empty($output) ? t($message, $placeholders) : $output;
      drupal_debug($output);
    }
    else {
      $output = empty($output) ? t($message, $placeholders) : $output;
      dpm($output);
    }
  }
  elseif (isset($GLOBALS['drupal_test_info'])) {
    $output = empty($output) ? t($message, $placeholders) : $output;
    debug($output);
  }
}