function user_views_query_substitutions

Same name in other branches
  1. 9 core/modules/user/user.views_execution.inc \user_views_query_substitutions()
  2. 10 core/modules/user/user.views_execution.inc \user_views_query_substitutions()
  3. 11.x 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

Code

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.