UserViewsExecutionHooks.php
Namespace
Drupal\user\HookFile
-
core/
modules/ user/ src/ Hook/ UserViewsExecutionHooks.php
View source
<?php
namespace Drupal\user\Hook;
use Drupal\views\ViewExecutable;
use Drupal\Core\Hook\Attribute\Hook;
/**
* Hook implementations for user.
*/
class UserViewsExecutionHooks {
/**
* Implements hook_views_query_substitutions().
*
* Allow replacement of current user ID so we can cache these queries.
*/
public function viewsQuerySubstitutions(ViewExecutable $view) {
return [
'***CURRENT_USER***' => \Drupal::currentUser()->id(),
];
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
UserViewsExecutionHooks | Hook implementations for user. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.