You are here

function user_views_query_substitutions in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/user/user.views_execution.inc \user_views_query_substitutions()
  2. 9 core/modules/user/user.views_execution.inc \user_views_query_substitutions()

Implements hook_views_query_substitutions().

Allow replacement of current user ID so we can cache these queries.

File

core/modules/user/user.views_execution.inc, line 15
Provide views runtime hooks for user.module.

Code

function user_views_query_substitutions(ViewExecutable $view) {
  return [
    '***CURRENT_USER***' => \Drupal::currentUser()
      ->id(),
  ];
}