You are here

public static function EntityOwnerTrait::getDefaultEntityOwner in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/user/src/EntityOwnerTrait.php \Drupal\user\EntityOwnerTrait::getDefaultEntityOwner()
  2. 10 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();
}