function views_contextual_filters_or_views_preview_info_alter in Views Contextual Filters OR 7
Implements hook_views_preview_info_alter().
File
- ./
views_contextual_filters_or.module, line 22 - Primarily Drupal hooks to manipulate Views Contextual Filters OR.
Code
function views_contextual_filters_or_views_preview_info_alter(&$rows, $view) {
$show_query = variable_get('views_ui_show_sql_query', FALSE);
$query = $view->build_info['query'];
if (get_class($view->query) == 'views_contextual_filters_or_query' && $show_query) {
$quoted = $query
->getArguments();
$connection = Database::getConnection();
foreach ($quoted as $key => $val) {
if (is_array($val)) {
$quoted[$key] = implode(', ', array_map(array(
$connection,
'quote',
), $val));
}
else {
$quoted[$key] = $connection
->quote($val);
}
}
$rows['query'][0] = array(
'<strong>' . t('Query') . '</strong>',
'<pre>' . check_plain(strtr($query, $quoted)) . '</pre>',
);
}
}