diff --git a/core/modules/node/src/NodeForm.php b/core/modules/node/src/NodeForm.php index 30a2562..032a8e8 100644 --- a/core/modules/node/src/NodeForm.php +++ b/core/modules/node/src/NodeForm.php @@ -378,7 +378,8 @@ public function buildEntity(array $form, FormStateInterface $form_state) { $entity = parent::buildEntity($form, $form_state); // A user might assign the node author by entering a user name in the node // form, which we then need to translate to a user ID. - if (!$form_state->isValueEmpty('uid') && $account = User::load($form_state->getValue('uid')[0]['target_id'])) { + // @todo: Remove it when https://www.drupal.org/node/2322525 is pushed. + if (!empty($form_state->getValue('uid')[0]['target_id']) && $account = User::load($form_state->getValue('uid')[0]['target_id'])) { $entity->setOwnerId($account->id()); } else { diff --git a/core/modules/node/src/Tests/PagePreviewTest.php b/core/modules/node/src/Tests/PagePreviewTest.php index 3a89473..71f39aa 100644 --- a/core/modules/node/src/Tests/PagePreviewTest.php +++ b/core/modules/node/src/Tests/PagePreviewTest.php @@ -175,6 +175,10 @@ function testPagePreview() { * Checks the node preview functionality, when using revisions. */ function testPagePreviewWithRevisions() { + // Revision Log field is accessible to administrators only. + $admin_user = $this->drupalCreateUser(array('administer nodes', 'edit own page content', 'create page content')); + $this->drupalLogin($admin_user); + $title_key = 'title[0][value]'; $body_key = 'body[0][value]'; $term_key = $this->field_name;