diff --git a/core/core.services.yml b/core/core.services.yml index 0b18c3b..5997021 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -736,7 +736,6 @@ services: arguments: ['%language.default_values%'] string_translator.custom_strings: class: Drupal\Core\StringTranslation\Translator\CustomStrings - arguments: ['@settings'] tags: - { name: string_translator, priority: 30 } string_translation: diff --git a/core/lib/Drupal/Core/StringTranslation/Translator/CustomStrings.php b/core/lib/Drupal/Core/StringTranslation/Translator/CustomStrings.php index 9d9a3b3..0fbf9bf 100644 --- a/core/lib/Drupal/Core/StringTranslation/Translator/CustomStrings.php +++ b/core/lib/Drupal/Core/StringTranslation/Translator/CustomStrings.php @@ -13,28 +13,10 @@ class CustomStrings extends StaticTranslation { /** - * The settings read only object. - * - * @var \Drupal\Core\Site\Settings - */ - protected $settings; - - /** - * Constructs a CustomStrings object. - * - * @param \Drupal\Core\Site\Settings $settings - * The settings read only object. - */ - public function __construct(Settings $settings) { - parent::__construct(); - $this->settings = $settings; - } - - /** * {@inheritdoc} */ protected function getLanguage($langcode) { - return $this->settings->get('locale_custom_strings_' . $langcode, array()); + return Settings::get('locale_custom_strings_' . $langcode, array()); } } diff --git a/core/modules/datetime/src/Tests/DateTimeFormInjectionTest.php b/core/modules/datetime/src/Tests/DateTimeFormInjectionTest.php new file mode 100644 index 0000000..150c909 --- /dev/null +++ b/core/modules/datetime/src/Tests/DateTimeFormInjectionTest.php @@ -0,0 +1,119 @@ + 'datelist test', + '#type' => 'datelist', + '#default_value' => new DrupalDateTime('2000-01-01 00:00:00'), + '#date_part_order' => array( + 'month', + 'day', + 'year', + 'hour', + 'minute', 'ampm', + ), + '#date_text_parts' => array('year'), + '#date_year_range' => '2010:2020', + '#date_increment' => 15, + ); + $form['#process'][] = [$this, 'process']; + return $form; + } + + /** + * {@inheritdoc} + */ + public function validateForm(array &$form, FormStateInterface $form_state) {} + + /** + * {@inheritdoc} + */ + public function submitForm(array &$form, FormStateInterface $form_state) { + $this->assertTrue(TRUE); + $form_state->setRebuild(); + } + + /** + * {@inheritdoc} + */ + protected function setUp() { + parent::setUp(); + $this->installSchema('system', ['key_value_expire', 'sequences']); + } + + /** + * Tests db log injection serialization. + */ + public function testDatetimeSerialization() { + $form_state = new FormState(); + $form_state->setRequestMethod('POST'); + $form_state->setCached(); + $form_builder = $this->container->get('form_builder'); + $form_id = $form_builder->getFormId($this, $form_state); + $form = $form_builder->retrieveForm($form_id, $form_state); + $form_builder->prepareForm($form_id, $form, $form_state); + $form_builder->processForm($form_id, $form, $form_state); + } + +}