diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/TimestampWidget.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/TimestampWidget.php index ffc7b86..17095ab 100644 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/TimestampWidget.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/TimestampWidget.php @@ -67,7 +67,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen * * @todo Convert to massageFormValues() after https://drupal.org/node/2226723 lands. */ - public function elementValidate($element, &$form_state, $form) { + public function elementValidate($element, FormStateInterface $form_state, $form) { $value = trim($element['#value']); if (empty($value)) { $value = $this->getSetting('use_request_time_on_empty') ? REQUEST_TIME : 0; diff --git a/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeTimestampWidget.php b/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeTimestampWidget.php index 828a7c5..b508954 100644 --- a/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeTimestampWidget.php +++ b/core/modules/datetime/src/Plugin/Field/FieldWidget/DateTimeTimestampWidget.php @@ -49,7 +49,7 @@ public function formElement(FieldItemListInterface $items, $delta, array $elemen * * @todo Convert to massageFormValues() after https://drupal.org/node/2226723 lands. */ - public function elementValidate($element, &$form_state, $form) { + public function elementValidate($element, FormStateInterface $form_state, $form) { $date = $element['#value']['object']; if ($date->hasErrors()) { $value = -1; diff --git a/core/modules/entity/src/Tests/EntityDisplayTest.php b/core/modules/entity/src/Tests/EntityDisplayTest.php index 219ba07..3aaab55 100644 --- a/core/modules/entity/src/Tests/EntityDisplayTest.php +++ b/core/modules/entity/src/Tests/EntityDisplayTest.php @@ -291,7 +291,8 @@ public function testRenameDeleteBundle() { $expected_view_dependencies = array( 'entity' => array('field.instance.node.article_rename.body', 'node.type.article_rename'), 'module' => array('text', 'user') - );$expected_form_dependencies = array( + ); + $expected_form_dependencies = array( 'entity' => array('field.instance.node.article_rename.body', 'node.type.article_rename'), 'module' => array('text') ); diff --git a/core/modules/node/src/NodeForm.php b/core/modules/node/src/NodeForm.php index b96bf53..4a4a8fe 100644 --- a/core/modules/node/src/NodeForm.php +++ b/core/modules/node/src/NodeForm.php @@ -284,21 +284,6 @@ public function validate(array $form, FormStateInterface $form_state) { $form_state->setErrorByName('changed', $this->t('The content on this page has either been modified by another user, or you have already submitted modifications using this form. As a result, your changes cannot be saved.')); } - // Validate the "authored by" field. - if (!$form_state->isValueEmpty('uid') && !user_load_by_name($form_state->getValue('uid'))) { - // The use of empty() is mandatory in the context of usernames - // as the empty string denotes the anonymous user. In case we - // are dealing with an anonymous user we set the user ID to 0. - $form_state->setErrorByName('uid', $this->t('The username %name does not exist.', array('%name' => $form_state->getValue('uid')))); - } - - // Validate the "authored on" field. - // The date element contains the date object. - $date = $node->date instanceof DrupalDateTime ? $node->date : new DrupalDateTime($node->date); - if ($date->hasErrors()) { - $form_state->setErrorByName('date', $this->t('You have to specify a valid date.')); - } - // Invoke hook_node_validate() for validation needed by modules. // Can't use \Drupal::moduleHandler()->invokeAll(), because $form_state must // be receivable by reference. diff --git a/core/modules/node/src/NodeTranslationHandler.php b/core/modules/node/src/NodeTranslationHandler.php index 4ed4769..532e33f 100644 --- a/core/modules/node/src/NodeTranslationHandler.php +++ b/core/modules/node/src/NodeTranslationHandler.php @@ -76,14 +76,13 @@ protected function entityFormTitle(EntityInterface $entity) { */ public function entityFormEntityBuild($entity_type, EntityInterface $entity, array $form, FormStateInterface $form_state) { if ($form_state->hasValue('content_translation')) { - $form_controller = content_translation_form_controller($form_state); $translation = &$form_state->getValue('content_translation'); - $translation['status'] = $form_controller->getEntity()->isPublished(); + $translation['status'] = $entity->isPublished(); // $form['content_translation']['name'] is the equivalent field // for translation author uid. $account = $entity->uid->entity; $translation['name'] = $account ? $account->getUsername() : ''; - $translation['created'] = format_date($form_state['values']['created'][0]['value'], 'custom', 'Y-m-d H:i:s O'); + $translation['created'] = format_date($entity->created->value, 'custom', 'Y-m-d H:i:s O'); } parent::entityFormEntityBuild($entity_type, $entity, $form, $form_state); }