CurrentUser.php in Drupal 10
File
core/modules/user/src/Plugin/views/argument_default/CurrentUser.php
View source
<?php
namespace Drupal\user\Plugin\views\argument_default;
use Drupal\Core\Cache\Cache;
use Drupal\Core\Cache\CacheableDependencyInterface;
use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase;
class CurrentUser extends ArgumentDefaultPluginBase implements CacheableDependencyInterface {
public function getArgument() {
return \Drupal::currentUser()
->id();
}
public function getCacheMaxAge() {
return Cache::PERMANENT;
}
public function getCacheContexts() {
return [
'user',
];
}
}
Classes
Name |
Description |
CurrentUser |
Default argument plugin to extract the current user. |