1.7.x views.api.php hook_views_query_substitutions($view)
1.10.x views.api.php hook_views_query_substitutions($view)
1.8.x views.api.php hook_views_query_substitutions($view)
1.9.x views.api.php hook_views_query_substitutions($view)

Performs replacements in the query before being performed.

Parameters

$view: The View being executed.

Return value

An array with keys being the strings to replace, and the values the strings to replace them with. The strings to replace are ofted surrounded with '***', as illustrated in the example implementation.

Related topics

File

modules/views/views.api.php, line 667
Describe hooks provided by the Views module.

Code

function hook_views_query_substitutions($view) {
  // Example from views_views_query_substitutions().
  global $language_content;
  return array(
    '***CURRENT_VERSION***' => BACKDROP_VERSION,
    '***CURRENT_TIME***' => REQUEST_TIME,
    '***CURRENT_LANGUAGE***' => $language_content->langcode,
    '***DEFAULT_LANGUAGE***' => language_default()->langcode,
  );
}