function EntityOwnerTrait::getDefaultEntityOwner

Same name in other branches
  1. 8.9.x core/modules/user/src/EntityOwnerTrait.php \Drupal\user\EntityOwnerTrait::getDefaultEntityOwner()
  2. 10 core/modules/user/src/EntityOwnerTrait.php \Drupal\user\EntityOwnerTrait::getDefaultEntityOwner()
  3. 11.x core/modules/user/src/EntityOwnerTrait.php \Drupal\user\EntityOwnerTrait::getDefaultEntityOwner()

Default value callback for 'owner' base field.

Return value

mixed A default value for the owner field.

1 method overrides EntityOwnerTrait::getDefaultEntityOwner()
File::getDefaultEntityOwner in core/modules/file/src/Entity/File.php
Default value callback for 'owner' base field.

File

core/modules/user/src/EntityOwnerTrait.php, line 86

Class

EntityOwnerTrait
Provides a trait for entities that have an owner.

Namespace

Drupal\user

Code

public static function getDefaultEntityOwner() {
    return \Drupal::currentUser()->id();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.