class User

Defines the user entity class.

Plugin annotation


@Plugin(
  id = "user",
  label = @Translation("User"),
  module = "user",
  controller_class = "Drupal\user\UserStorageController",
  render_controller_class = "Drupal\user\UserRenderController",
  form_controller_class = {
    "profile" = "Drupal\user\ProfileFormController",
    "register" = "Drupal\user\RegisterFormController"
  },
  default_operation = "profile",
  translation_controller_class = "Drupal\user\ProfileTranslationController",
  base_table = "users",
  uri_callback = "user_uri",
  label_callback = "user_label",
  fieldable = TRUE,
  entity_keys = {
    "id" = "uid",
    "uuid" = "uuid"
  },
  bundles = {
    "user" = {
      "label" = "User",
      "admin" = {
        "path" = "admin/config/people/accounts",
        "access arguments" = {"administer users"}
      }
    }
  },
  view_modes = {
    "full" = {
      "label" = "User account",
      "custom_settings" = FALSE
    },
    "compact" = {
      "label" = "Compact",
      "custom_settings" = TRUE
    }
  }
)

Hierarchy

Expanded class hierarchy of User

5 files declare their use of User
EntityAccessController.php in drupal/core/lib/Drupal/Core/Entity/EntityAccessController.php
Contains Drupal\Core\Entity\EntityAccessController.
EntityAccessControllerInterface.php in drupal/core/lib/Drupal/Core/Entity/EntityAccessControllerInterface.php
Contains Drupal\Core\Entity\EntityAccessControllerInterface.
EntityAccessTest.php in drupal/core/modules/system/lib/Drupal/system/Tests/Entity/EntityAccessTest.php
Contains Drupal\system\Tests\Entity\EntityAccessTest.
EntityTestAccessController.php in drupal/core/modules/system/tests/modules/entity_test/lib/Drupal/entity_test/EntityTestAccessController.php
Contains Drupal\entity_test\EntityTestAccessController.
Field.php in drupal/core/lib/Drupal/Core/Entity/Field/Type/Field.php
Definition of Drupal\Core\Entity\Field\Type\Field.
40 string references to 'User'
BreadcrumbTest::testBreadCrumbs in drupal/core/modules/system/lib/Drupal/system/Tests/Menu/BreadcrumbTest.php
Tests breadcrumbs on node and administrative paths.
dblog_event in drupal/core/modules/dblog/dblog.admin.inc
Page callback: Displays details about a specific database log message.
dblog_overview in drupal/core/modules/dblog/dblog.admin.inc
Page callback: Displays a listing of database log messages.
file_views_data in drupal/core/modules/file/file.views.inc
Implements hook_views_data().
node_views_data in drupal/core/modules/node/node.views.inc
Implements hook_views_data().

... See full list

File

drupal/core/modules/user/lib/Drupal/user/Plugin/Core/Entity/User.php, line 58
Definition of Drupal\user\Plugin\Core\Entity\User.

Namespace

Drupal\user\Plugin\Core\Entity
View source
class User extends Entity {

  /**
   * The user ID.
   *
   * @var integer
   */
  public $uid;

  /**
   * The user UUID.
   *
   * @var string
   */
  public $uuid;

  /**
   * The unique user name.
   *
   * @var string
   */
  public $name = '';

  /**
   * The user's password (hashed).
   *
   * @var string
   */
  public $pass;

  /**
   * The user's email address.
   *
   * @var string
   */
  public $mail = '';

  /**
   * The user's default theme.
   *
   * @var string
   */
  public $theme;

  /**
   * The user's signature.
   *
   * @var string
   */
  public $signature;

  /**
   * The user's signature format.
   *
   * @var string
   */
  public $signature_format;

  /**
   * The timestamp when the user was created.
   *
   * @var integer
   */
  public $created;

  /**
   * The timestamp when the user last accessed the site. A value of 0 means the
   * user has never accessed the site.
   *
   * @var integer
   */
  public $access = 0;

  /**
   * The timestamp when the user last logged in. A value of 0 means the user has
   * never logged in.
   *
   * @var integer
   */
  public $login = 0;

  /**
   * Whether the user is active (1) or blocked (0).
   *
   * @var integer
   */
  public $status = 1;

  /**
   * The user's timezone.
   *
   * @var string
   */
  public $timezone;

  /**
   * The user's langcode.
   *
   * @var string
   */
  public $langcode = LANGUAGE_NOT_SPECIFIED;

  /**
   * The user's preferred langcode for receiving emails and viewing the site.
   *
   * @var string
   */
  public $preferred_langcode = LANGUAGE_NOT_SPECIFIED;

  /**
   * The user's preferred langcode for viewing administration pages.
   *
   * @var string
   */
  public $preferred_admin_langcode = LANGUAGE_NOT_SPECIFIED;

  /**
   * The email address used for initial account creation.
   *
   * @var string
   */
  public $init = '';

  /**
   * The user's roles.
   *
   * @var array
   */
  public $roles = array();

  /**
   * Implements Drupal\Core\Entity\EntityInterface::id().
   */
  public function id() {
    return $this->uid;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Entity::$enforceIsNew protected property Boolean indicating whether the entity should be forced to be new.
Entity::$entityType protected property The entity type.
Entity::$isDefaultRevision protected property Indicates whether this is the default revision. 1
Entity::$newRevision protected property Boolean indicating whether a new revision should be created on save.
Entity::access public function Implements AccessibleInterface::access(). Overrides AccessibleInterface::access
Entity::bundle public function Implements EntityInterface::bundle(). Overrides EntityInterface::bundle 4
Entity::createDuplicate public function Implements EntityInterface::createDuplicate(). Overrides EntityInterface::createDuplicate 3
Entity::delete public function Implements EntityInterface::delete(). Overrides EntityInterface::delete
Entity::enforceIsNew public function Implements EntityInterface::enforceIsNew(). Overrides EntityInterface::enforceIsNew
Entity::entityInfo public function Implements EntityInterface::entityInfo(). Overrides EntityInterface::entityInfo
Entity::entityType public function Implements EntityInterface::entityType(). Overrides EntityInterface::entityType
Entity::get public function Implements EntityInterface::get(). Overrides ComplexDataInterface::get 2
Entity::getIterator public function Implements ComplexDataInterface::getIterator(). 1
Entity::getProperties public function Implements ComplexDataInterface::getProperties(). Overrides ComplexDataInterface::getProperties 1
Entity::getPropertyDefinition public function Implements ComplexDataInterface::getPropertyDefinition(). Overrides ComplexDataInterface::getPropertyDefinition 1
Entity::getPropertyDefinitions public function Implements ComplexDataInterface::getPropertyDefinitions(). Overrides ComplexDataInterface::getPropertyDefinitions 1
Entity::getPropertyValues public function Implements ComplexDataInterface::getPropertyValues(). Overrides ComplexDataInterface::getPropertyValues 1
Entity::getRevisionId public function Implements Drupal\Core\Entity\EntityInterface::getRevisionId(). Overrides EntityInterface::getRevisionId 3
Entity::getTranslation public function Implements TranslatableInterface::getTranslation(). Overrides TranslatableInterface::getTranslation 1
Entity::getTranslationLanguages public function Implements TranslatableInterface::getTranslationLanguages(). Overrides TranslatableInterface::getTranslationLanguages 1
Entity::isDefaultRevision public function Implements Drupal\Core\Entity\EntityInterface::isDefaultRevision(). Overrides EntityInterface::isDefaultRevision 1
Entity::isEmpty public function Implements ComplexDataInterface::isEmpty(). Overrides ComplexDataInterface::isEmpty 1
Entity::isNew public function Implements EntityInterface::isNew(). Overrides EntityInterface::isNew 1
Entity::isNewRevision public function Implements EntityInterface::isNewRevision(). Overrides EntityInterface::isNewRevision
Entity::label public function Implements EntityInterface::label(). Overrides EntityInterface::label 1
Entity::language public function Implements TranslatableInterface::language(). Overrides TranslatableInterface::language 1
Entity::save public function Implements EntityInterface::save(). Overrides EntityInterface::save 3
Entity::set public function Implements ComplexDataInterface::set(). Overrides ComplexDataInterface::set 2
Entity::setNewRevision public function Implements EntityInterface::setNewRevision(). Overrides EntityInterface::setNewRevision
Entity::setPropertyValues public function Implements ComplexDataInterface::setPropertyValues(). Overrides ComplexDataInterface::setPropertyValues 1
Entity::translations public function Returns the languages the entity is translated to.
Entity::uri public function Implements EntityInterface::uri(). Overrides EntityInterface::uri 1
Entity::uuid public function Implements EntityInterface::uuid(). Overrides EntityInterface::uuid 1
Entity::__construct public function Constructs an Entity object. 2
User::$access public property The timestamp when the user last accessed the site. A value of 0 means the user has never accessed the site.
User::$created public property The timestamp when the user was created.
User::$init public property The email address used for initial account creation.
User::$langcode public property The user's langcode. Overrides Entity::$langcode
User::$login public property The timestamp when the user last logged in. A value of 0 means the user has never logged in.
User::$mail public property The user's email address.
User::$name public property The unique user name.
User::$pass public property The user's password (hashed).
User::$preferred_admin_langcode public property The user's preferred langcode for viewing administration pages.
User::$preferred_langcode public property The user's preferred langcode for receiving emails and viewing the site.
User::$roles public property The user's roles.
User::$signature public property The user's signature.
User::$signature_format public property The user's signature format.
User::$status public property Whether the user is active (1) or blocked (0).
User::$theme public property The user's default theme.
User::$timezone public property The user's timezone.
User::$uid public property The user ID.
User::$uuid public property The user UUID.
User::id public function Implements Drupal\Core\Entity\EntityInterface::id(). Overrides Entity::id