diff --git a/core/modules/datetime/config/schema/datetime.schema.yml b/core/modules/datetime/config/schema/datetime.schema.yml index 1d8f595..a333f56 100644 --- a/core/modules/datetime/config/schema/datetime.schema.yml +++ b/core/modules/datetime/config/schema/datetime.schema.yml @@ -23,6 +23,8 @@ field.datetime.value: sequence: - type: string label: 'Value' + - type: string + label: 'Type' entity_view_display.field.datetime_default: type: entity_field_view_display_base diff --git a/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php b/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php index a3a4a34..ebf5c7d 100644 --- a/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php +++ b/core/modules/datetime/src/Plugin/Field/FieldType/DateTimeFieldItemList.php @@ -43,7 +43,7 @@ public function defaultValuesForm(array &$form, FormStateInterface $form_state) '#description' => t('Set a default value for this date.'), '#default_value' => isset($default_value[0]['default_date_type']) ? $default_value[0]['default_date_type'] : '', '#options' => array( - static::DEFAULT_VALUE_NOW => t('The current date'), + static::DEFAULT_VALUE_NOW => t('Current date'), static::DEFAULT_VALUE_CUSTOM => t('Relative value'), ), '#empty_value' => '', @@ -51,7 +51,7 @@ public function defaultValuesForm(array &$form, FormStateInterface $form_state) 'default_date' => array( '#type' => 'textfield', '#title' => t('Relative default value'), - '#description' => t("Describe a time by reference to the current day, like '+90 days' (90 days from the day the field is created) or '+1 Saturday' (the next Saturday). See !strtotime for more details.", array('!strtotime' => l(t('strtotime'), 'http://www.php.net/manual/en/function.strtotime.php'))), + '#description' => t("Describe a time by reference to the current day, like '+90 days' (90 days from the day the field is created) or '+1 Saturday' (the next Saturday). See !strtotime for more details.", array('!strtotime' => l('strtotime', 'http://www.php.net/manual/en/function.strtotime.php'))), '#default_value' => (isset($default_value[0]['default_date_type']) && $default_value[0]['default_date_type'] == static::DEFAULT_VALUE_CUSTOM) ? $default_value[0]['default_date'] : '', '#states' => array( 'visible' => array( diff --git a/core/modules/datetime/src/Tests/DateTimeFieldTest.php b/core/modules/datetime/src/Tests/DateTimeFieldTest.php index e0b9d11..b36777c 100644 --- a/core/modules/datetime/src/Tests/DateTimeFieldTest.php +++ b/core/modules/datetime/src/Tests/DateTimeFieldTest.php @@ -354,7 +354,7 @@ function testDefaultValue() { // Clear field cache in order to avoid stale cache values. \Drupal::entityManager()->clearCachedFieldDefinitions(); - // Create a new node to check that datetime field default value is today. + // Create a new node to check that datetime field default value is +90 days. $new_node = entity_create('node', array('type' => 'date_content')); $expected_date = new DrupalDateTime('+90 days', DATETIME_STORAGE_TIMEZONE); $this->assertEqual($new_node->get($field_storage->name)->offsetGet(0)->value, $expected_date->format(DATETIME_DATE_STORAGE_FORMAT)); @@ -377,7 +377,7 @@ function testDefaultValue() { // Clear field cache in order to avoid stale cache values. \Drupal::entityManager()->clearCachedFieldDefinitions(); - // Create a new node to check that datetime field default value is today. + // Create a new node to check that datetime field default value is not set. $new_node = entity_create('node', array('type' => 'date_content')); $this->assertNull($new_node->get($field_storage->name)->offsetGet(0)->value, 'Default value is not set'); }