You are here

public static function EntityOwnerTrait::getDefaultEntityOwner in Drupal 10

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