diff --git a/core/modules/config_translation/src/ConfigMapperInterface.php b/core/modules/config_translation/src/ConfigMapperInterface.php index 9815f85..90d405a 100644 --- a/core/modules/config_translation/src/ConfigMapperInterface.php +++ b/core/modules/config_translation/src/ConfigMapperInterface.php @@ -253,11 +253,11 @@ public function getTypeLabel(); public function hasSchema(); /** - * Checks that all pieces of this configuration mapper have translatables. + * Checks if pieces of this configuration mapper have translatables. * * @return bool - * TRUE if all of the configuration elements have translatables, FALSE - * otherwise. + * TRUE if at least one of the configuration elements has translatables, + * FALSE otherwise. */ public function hasTranslatable(); diff --git a/core/modules/config_translation/src/ConfigNamesMapper.php b/core/modules/config_translation/src/ConfigNamesMapper.php index 6a51be6..4d98e2a 100644 --- a/core/modules/config_translation/src/ConfigNamesMapper.php +++ b/core/modules/config_translation/src/ConfigNamesMapper.php @@ -438,11 +438,11 @@ public function hasSchema() { */ public function hasTranslatable() { foreach ($this->getConfigNames() as $name) { - if (!$this->configMapperManager->hasTranslatable($name)) { - return FALSE; + if ($this->configMapperManager->hasTranslatable($name)) { + return TRUE; } } - return TRUE; + return FALSE; } /** diff --git a/core/modules/config_translation/tests/src/Unit/ConfigNamesMapperTest.php b/core/modules/config_translation/tests/src/Unit/ConfigNamesMapperTest.php index 9ecc32b..0223c6f 100644 --- a/core/modules/config_translation/tests/src/Unit/ConfigNamesMapperTest.php +++ b/core/modules/config_translation/tests/src/Unit/ConfigNamesMapperTest.php @@ -538,7 +538,7 @@ public function testHasTranslatable(array $mock_return_values, $expected) { $map = array(); foreach ($config_names as $i => $config_name) { - $map[] = array($config_name, $mock_return_values[$i]); + $map[] = isset($mock_return_values[$i]) ? array($config_name, $mock_return_values[$i]) : array(); } $this->configMapperManager ->expects($this->any()) @@ -560,10 +560,12 @@ public function testHasTranslatable(array $mock_return_values, $expected) { */ public function providerTestHasTranslatable() { return array( + array(array(), FALSE), array(array(TRUE), TRUE), array(array(FALSE), FALSE), array(array(TRUE, TRUE, TRUE), TRUE), - array(array(TRUE, FALSE, TRUE), FALSE), + array(array(FALSE, FALSE, FALSE), FALSE), + array(array(TRUE, FALSE, TRUE), TRUE), ); }