function hook_views_query_substitutions

Performs replacements in the query before being performed.

Parameters

object $view: The View being executed.

Return value

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

Related topics

9 functions implement hook_views_query_substitutions()

Note: the procedural functions in this list are found by pattern matching, so the list may include some functions that are not actually implementations of this hook.

ContentModerationViewsExecutionHooks::viewsQuerySubstitutions in core/modules/content_moderation/src/Hook/ContentModerationViewsExecutionHooks.php
Implements hook_views_query_substitutions().
MediaHooks::viewsQuerySubstitutions in core/modules/media/src/Hook/MediaHooks.php
Implements hook_views_query_substitutions().
NodeViewsExecutionHooks::viewsQuerySubstitutions in core/modules/node/src/Hook/NodeViewsExecutionHooks.php
Implements hook_views_query_substitutions().
node_views_query_substitutions in modules/node.views.inc
Implements hook_views_query_substitutions().
UserViewsExecutionHooks::viewsQuerySubstitutions in core/modules/user/src/Hook/UserViewsExecutionHooks.php
Implements hook_views_query_substitutions().

... See full list

2 invocations of hook_views_query_substitutions()
views_plugin_query_default::execute in plugins/views_plugin_query_default.inc
Executes the query and fills the associated view object with according values.
views_plugin_query_default::query in plugins/views_plugin_query_default.inc
Generate a query and a countquery from all of the information supplied to the object.

File

./views.api.php, line 934

Code

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