diff --git a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/RouteBasedAutocompleteWidget.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/RouteBasedAutocompleteWidget.php deleted file mode 100644 index cf8b2c3..0000000 --- a/core/lib/Drupal/Core/Field/Plugin/Field/FieldWidget/RouteBasedAutocompleteWidget.php +++ /dev/null @@ -1,48 +0,0 @@ - '', - ) + parent::defaultSettings(); - } - - /** - * {@inheritdoc} - */ - public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, array &$form_state) { - $element['target_id'] = $element + array( - '#type' => 'textfield', - '#default_value' => $items[$delta]->value, - '#autocomplete_route_name' => $this->getSetting('route_name'), - ); - - return $element; - } - -} diff --git a/core/modules/datetime/config/schema/datetime.schema.yml b/core/modules/datetime/config/schema/datetime.schema.yml index 1d8f595..9dab6c6 100644 --- a/core/modules/datetime/config/schema/datetime.schema.yml +++ b/core/modules/datetime/config/schema/datetime.schema.yml @@ -73,3 +73,13 @@ entity_form_display.field.datetime_default: label: 'Settings' sequence: - type: string + +entity_form_display.field.datetime_timestamp: + type: entity_field_form_display_base + label: 'Datetime timestamp display format settings' + mapping: + settings: + type: sequence + label: 'Settings' + sequence: + - type: string diff --git a/core/modules/node/src/NodeForm.php b/core/modules/node/src/NodeForm.php index 8878479..60844a9 100644 --- a/core/modules/node/src/NodeForm.php +++ b/core/modules/node/src/NodeForm.php @@ -151,13 +151,13 @@ public function form(array $form, array &$form_state) { '#optional' => TRUE, ); - $form['uid'] = array( + $form['uid'] += array( '#group' => 'author', '#access' => $current_user->hasPermission('administer nodes'), ); $form['uid']['widget'][0]['value']['#title'] = $this->t('Authored by'); - $form['created'] = array( + $form['created'] += array( '#group' => 'author', '#access' => $current_user->hasPermission('administer nodes'), ); @@ -178,12 +178,12 @@ public function form(array $form, array &$form_state) { '#optional' => TRUE, ); - $form['promote'] = array( + $form['promote'] += array( '#group' => 'options', '#access' => $current_user->hasPermission('administer nodes'), ); - $form['sticky'] = array( + $form['sticky'] += array( '#group' => 'options', '#access' => $current_user->hasPermission('administer nodes'), ); diff --git a/core/modules/node/src/Tests/MultiStepNodeFormBasicOptionsTest.php b/core/modules/node/src/Tests/MultiStepNodeFormBasicOptionsTest.php index 3571a23..157927e 100644 --- a/core/modules/node/src/Tests/MultiStepNodeFormBasicOptionsTest.php +++ b/core/modules/node/src/Tests/MultiStepNodeFormBasicOptionsTest.php @@ -56,13 +56,13 @@ function testMultiStepNodeFormBasicOptions() { $edit = array( 'title[0][value]' => 'a', - 'promote[0][value]' => FALSE, - 'sticky[0][value]' => 1, + 'promote[value]' => FALSE, + 'sticky[value]' => 1, "{$this->field_name}[0][value]" => $this->randomString(32), ); $this->drupalPostForm('node/add/page', $edit, t('Add another item')); - $this->assertNoFieldChecked('edit-promote-0-value', 'promote stayed unchecked'); - $this->assertFieldChecked('edit-sticky-0-value', 'sticky stayed checked'); + $this->assertNoFieldChecked('edit-promote-value', 'promote stayed unchecked'); + $this->assertFieldChecked('edit-sticky-value', 'sticky stayed checked'); } } diff --git a/core/modules/node/src/Tests/NodeTranslationUITest.php b/core/modules/node/src/Tests/NodeTranslationUITest.php index 4ad1248..732f724 100644 --- a/core/modules/node/src/Tests/NodeTranslationUITest.php +++ b/core/modules/node/src/Tests/NodeTranslationUITest.php @@ -155,8 +155,8 @@ protected function doTestAuthoringInfo() { 'uid[0][target_id]' => $user->getUsername(), 'created[0][value][date]' => format_date($values[$langcode]['created'], 'custom', 'Y-m-d'), 'created[0][value][time]' => format_date($values[$langcode]['created'], 'custom', 'H:i:s'), - 'sticky[0][value]' => $values[$langcode]['sticky'], - 'promote[0][value]' => $values[$langcode]['promote'], + 'sticky[value]' => $values[$langcode]['sticky'], + 'promote[value]' => $values[$langcode]['promote'], ); $this->drupalPostForm($path, $edit, $this->getFormSubmitAction($entity, $langcode), array('language' => $languages[$langcode])); } diff --git a/core/modules/user/src/Plugin/Field/FieldWidget/AuthorAutocompleteWidget.php b/core/modules/user/src/Plugin/Field/FieldWidget/AuthorAutocompleteWidget.php deleted file mode 100644 index 43834df..0000000 --- a/core/modules/user/src/Plugin/Field/FieldWidget/AuthorAutocompleteWidget.php +++ /dev/null @@ -1,74 +0,0 @@ -entity && $items[$delta]->entity->isAuthenticated() ? $items[$delta]->entity->getUsername() : ''; - - $user_config = \Drupal::config('user.settings'); - $element['target_id']['#description'] = $this->t('Leave blank for %anonymous.', array('%anonymous' => $user_config->get('anonymous'))); - - $element['target_id']['#element_validate'] = array(array($this, 'elementValidate')); - - return $element; - } - - /** - * Validates an element. - * - * @todo Convert to massageFormValues() after https://drupal.org/node/2226723 lands. - */ - public function elementValidate($element, &$form_state, $form) { - $form_builder = \Drupal::formBuilder(); - $value = $element['#value']; - // 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. - if (empty($value)) { - $value = 0; - } - else { - $account = user_load_by_name($value); - if ($account !== FALSE) { - $value = $account->id(); - } - else { - // Edge case: a non-existing numeric username should not be treated as - // a user ID (entity reference target_id). The ValidReference constraint - // would consider this a valid user ID, therefore we need additional - // validation here. - $form_builder->setError($element, $form_state, $this->t('The username %name does not exist.', array('%name' => $value))); - $value = NULL; - } - } - $form_builder->setValue($element, $value, $form_state); - } - -}