diff --git a/core/modules/node/src/Entity/Node.php b/core/modules/node/src/Entity/Node.php index 0fe594e..bc9f680 100644 --- a/core/modules/node/src/Entity/Node.php +++ b/core/modules/node/src/Entity/Node.php @@ -375,10 +375,9 @@ public static function baseFieldDefinitions(EntityTypeInterface $entity_type) { ->setRevisionable(TRUE) ->setSettings(array( 'target_type' => 'user', - 'default_value' => 0, 'handler' => 'default', )) - ->setDefaultValueCallback(array('\Drupal', 'currentUser')) + ->setDefaultValueCallback(array('Drupal\node\Entity\Node', 'getCurrentUserId')) ->setTranslatable(TRUE) ->setDisplayOptions('view', array( 'label' => 'hidden', @@ -515,4 +514,14 @@ public static function bundleFieldDefinitions(EntityTypeInterface $entity_type, return $fields; } + /** + * Helper callback to pass into 'uid' base field definition. + * + * @see ::baseFieldDefinitions() + * + * @return array + */ + public static function getCurrentUserId() { + return array(\Drupal::currentUser()->id()); + } } diff --git a/core/modules/system/src/Tests/Entity/EntityTranslationFormTest.php b/core/modules/system/src/Tests/Entity/EntityTranslationFormTest.php index f154a21..d45ef76 100644 --- a/core/modules/system/src/Tests/Entity/EntityTranslationFormTest.php +++ b/core/modules/system/src/Tests/Entity/EntityTranslationFormTest.php @@ -58,9 +58,9 @@ function testEntityFormLanguage() { // Create a node with language LanguageInterface::LANGCODE_NOT_SPECIFIED. $node = Node::create(array( 'type' => 'page', - 'title' => $this->randomName(8), + 'title' => $this->randomString(8), 'body' => array( - 'value' => $this->randomName(16), + 'value' => $this->randomString(16), ), 'uid' => $web_user->id(), ));