CurrentUser.php

Definition of Drupal\user\Plugin\views\argument_default\CurrentUser.

Namespace

Drupal\user\Plugin\views\argument_default

File

drupal/core/modules/user/lib/Drupal/user/Plugin/views/argument_default/CurrentUser.php
View source
<?php

/**
 * @file
 * Definition of Drupal\user\Plugin\views\argument_default\CurrentUser.
 */
namespace Drupal\user\Plugin\views\argument_default;

use Drupal\Core\Annotation\Plugin;
use Drupal\Core\Annotation\Translation;
use Drupal\views\Plugin\views\argument_default\ArgumentDefaultPluginBase;

/**
 * Default argument plugin to extract the global $user
 *
 * This plugin actually has no options so it odes not need to do a great deal.
 *
 * @Plugin(
 *   id = "current_user",
 *   module = "user",
 *   title = @Translation("User ID from logged in user")
 * )
 */
class CurrentUser extends ArgumentDefaultPluginBase {
  function get_argument() {
    global $user;
    return $user->uid;
  }

}

Classes

Namesort descending Description
CurrentUser Default argument plugin to extract the global $user