Skip to content
Snippets Groups Projects
Commit bb925230 authored by Angie Byron's avatar Angie Byron
Browse files

Issue #2094797 by dawehner, Gábor Hojtsy, webflo: Fixed Config entities upcast...

Issue #2094797 by dawehner, Gábor Hojtsy, webflo: Fixed Config entities upcast from the request always get default language context.
parent b3b073ea
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -134,7 +134,9 @@ public function getLocaleConfigName($name, Language $language) {
static function getSubscribedEvents() {
$events['config.context'][] = array('configContext', 20);
$events['config.load'][] = array('configLoad', 20);
$events[KernelEvents::REQUEST][] = array('onKernelRequestSetDefaultConfigContextLocale', 20);
// Set the priority above the one from the RouteListener (priority 32)
// so ensure that the context is cleared before the routing system steps in.
$events[KernelEvents::REQUEST][] = array('onKernelRequestSetDefaultConfigContextLocale', 48);
return $events;
}
}
......@@ -21,7 +21,7 @@ class LocaleConfigTranslationTest extends WebTestBase {
*
* @var array
*/
public static $modules = array('locale');
public static $modules = array('locale', 'contact');
public static function getInfo() {
return array(
......@@ -43,7 +43,7 @@ public function setUp() {
function testConfigTranslation() {
// Add custom language.
$langcode = 'xx';
$admin_user = $this->drupalCreateUser(array('administer languages', 'access administration pages', 'translate interface', 'administer modules'));
$admin_user = $this->drupalCreateUser(array('administer languages', 'access administration pages', 'translate interface', 'administer modules', 'access site-wide contact form'));
$this->drupalLogin($admin_user);
$name = $this->randomName(16);
$edit = array(
......@@ -144,6 +144,27 @@ function testConfigTranslation() {
// Ensure that the translated configuration has been removed.
$this->assertFalse(\Drupal::config('locale.config.xx.image.style.medium')->get('label'), 'Translated configuration for image module removed.');
// Translate default category using the UI so configuration is refreshed.
$category_label = $this->randomName(20);
$search = array(
'string' => 'Website feedback',
'langcode' => $langcode,
'translation' => 'all',
);
$this->drupalPostForm('admin/config/regional/translate', $search, t('Filter'));
$textarea = current($this->xpath('//textarea'));
$lid = (string) $textarea[0]['name'];
$edit = array(
$lid => $category_label,
);
$this->drupalPostForm('admin/config/regional/translate', $edit, t('Save translations'));
// Check if this category displayed in this language will use the
// translation. This test ensures the entity loaded from the request
// upcasting will already work.
$this->drupalGet($langcode . '/contact/feedback');
$this->assertText($category_label);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment