class CurrentUser in Drupal 10
Same name and namespace in other branches
- 8 core/modules/user/src/Plugin/views/argument_default/CurrentUser.php \Drupal\user\Plugin\views\argument_default\CurrentUser
 - 9 core/modules/user/src/Plugin/views/argument_default/CurrentUser.php \Drupal\user\Plugin\views\argument_default\CurrentUser
 
Default argument plugin to extract the current user.
This plugin actually has no options so it does not need to do a great deal.
Plugin annotation
@ViewsArgumentDefault(
  id = "current_user",
  title = @Translation("User ID from logged in user")
)
  Hierarchy
- class \Drupal\user\Plugin\views\argument_default\CurrentUser extends \Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase implements CacheableDependencyInterface
 
Expanded class hierarchy of CurrentUser
File
- core/
modules/ user/ src/ Plugin/ views/ argument_default/ CurrentUser.php, line 19  
Namespace
Drupal\user\Plugin\views\argument_defaultView source
class CurrentUser extends ArgumentDefaultPluginBase implements CacheableDependencyInterface {
  /**
   * {@inheritdoc}
   */
  public function getArgument() {
    return \Drupal::currentUser()
      ->id();
  }
  /**
   * {@inheritdoc}
   */
  public function getCacheMaxAge() {
    return Cache::PERMANENT;
  }
  /**
   * {@inheritdoc}
   */
  public function getCacheContexts() {
    return [
      'user',
    ];
  }
}Members
| 
            Name | 
                  Modifiers | Type | Description | Overrides | 
|---|---|---|---|---|
| 
            CacheableDependencyInterface:: | 
                  public | function | The cache tags associated with this object. | 14 | 
| 
            CurrentUser:: | 
                  public | function | ||
| 
            CurrentUser:: | 
                  public | function | 
            The cache contexts associated with this object. Overrides CacheableDependencyInterface:: | 
                  |
| 
            CurrentUser:: | 
                  public | function | 
            The maximum age for which this object may be cached. Overrides CacheableDependencyInterface:: |