function UserViewsExecutionHooks::viewsQuerySubstitutions

Implements hook_views_query_substitutions().

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

File

core/modules/user/src/Hook/UserViewsExecutionHooks.php, line 18

Class

UserViewsExecutionHooks
Hook implementations for user.

Namespace

Drupal\user\Hook

Code

public function viewsQuerySubstitutions(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.