diff -u b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php --- b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php +++ b/core/lib/Drupal/Core/Field/Plugin/Field/FieldFormatter/TimestampFormatter.php @@ -82,7 +82,7 @@ $configuration['view_mode'], $configuration['third_party_settings'], $container->get('date.formatter'), - $container->get('entity_type.manager')->getStorage('date_format') + $container->get('entity.manager')->getStorage('date_format') ); } @@ -91,11 +91,12 @@ */ public static function defaultSettings() { return [ - 'date_format' => 'medium', - 'custom_date_format' => '', - 'timezone' => '', - 'show_prefix_label' => FALSE, - ] + parent::defaultSettings(); + 'date_format' => 'medium', + 'custom_date_format' => '', + 'timezone' => '', + 'show_prefix_label' => FALSE, + 'prefix_label' => 'Authored on: ' + ] + parent::defaultSettings(); } /** @@ -114,11 +115,17 @@ $elements['show_prefix_label'] = [ '#type' => 'checkbox', - '#title' => $this->t('Show the "On" prefix'), + '#title' => $this->t('Show prefix'), '#description' => $this->t('Displays a prefix "on" before the content creation date.'), '#default_value' => $this->getSetting('show_prefix_label'), ]; + $elements['prefix_label'] = [ + '#type' => 'textfield', + '#title' => $this->t('Label for prefix'), + '#default_value' => $this->getSetting('prefix_label'), + ]; + $elements['date_format'] = [ '#type' => 'select', '#title' => $this->t('Date format'), @@ -152,12 +159,12 @@ */ public function settingsSummary() { $summary = parent::settingsSummary(); - + $prefix_label = $this->getSetting('prefix_label'); if ($this->getSetting('show_prefix_label')) { - $summary[] = $this->t('The "on" creation date prefix is displayed.'); + $summary[] = $this->t('The "@prefix" creation date prefix is displayed.', ['@prefix' => $prefix_label]); } else { - $summary[] = $this->t('The "on" creation date prefix is hidden.'); + $summary[] = $this->t('The "@prefix" creation date prefix is hidden.', ['@prefix' => $prefix_label]); } $date_format = $this->getSetting('date_format'); $summary[] = $this->t('Date format: @date_format', ['@date_format' => $date_format]); @@ -198,10 +205,10 @@ '#markup' => $this->dateFormatter->format($item->value, $date_format, $custom_date_format, $timezone, $langcode), ]; if ($this->getSetting('show_prefix_label')) { - $elements[$delta]['#prefix'] = $this->t('on '); + // Use translation for manual label. + $elements[$delta]['#prefix'] = $this->t($this->getSetting('prefix_label')); } } - return $elements; } diff -u b/core/modules/node/tests/src/Functional/NodeCreationTest.php b/core/modules/node/tests/src/Functional/NodeCreationTest.php --- b/core/modules/node/tests/src/Functional/NodeCreationTest.php +++ b/core/modules/node/tests/src/Functional/NodeCreationTest.php @@ -22,16 +22,12 @@ * * @var array */ - public static $modules = ['node_test_exception', 'dblog', 'test_page_test', 'field_ui']; + public static $modules = ['node_test_exception', 'dblog', 'test_page_test']; protected function setUp() { parent::setUp(); - $web_user = $this->drupalCreateUser([ - 'create page content', - 'edit own page content', - 'administer node display', - ]); + $web_user = $this->drupalCreateUser(['create page content', 'edit own page content']); $this->drupalLogin($web_user); } diff -u b/core/modules/rdf/tests/src/Functional/StandardProfileTest.php b/core/modules/rdf/tests/src/Functional/StandardProfileTest.php --- b/core/modules/rdf/tests/src/Functional/StandardProfileTest.php +++ b/core/modules/rdf/tests/src/Functional/StandardProfileTest.php @@ -98,14 +98,14 @@ protected $articleCommentUri; /** - * @var array + * @var string */ - public static $modules = ['field_ui']; + protected $articleCommentUri; /** - * @var string + * @var array */ - protected $articleCommentUri; + public static $modules = ['field_ui']; /** * @var string