Skip to content

Commit

Permalink
OPENEUROPA-660: Merge 'OPENEUROPA-660' of github.com:openeuropa/oe_mu…
Browse files Browse the repository at this point in the history
…ltilingual into OPENEUROPA-660
  • Loading branch information
sergepavle committed Oct 11, 2018
2 parents 0514dc0 + 8738311 commit f5058de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/MultilingualConfigOverride.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Drupal\Core\Config\StorageInterface;

/**
* Override some config values for customizing default behavior.
* Override configuration values related to multilingual elements.
*/
class MultilingualConfigOverride implements ConfigFactoryOverrideInterface {

Expand All @@ -17,6 +17,8 @@ class MultilingualConfigOverride implements ConfigFactoryOverrideInterface {
public function loadOverrides($names) {
$overrides = [];
foreach ($names as $config_name) {
// Force the default site's language as the default language and prevent
// the users from changing it when creating a node.
if (strpos($config_name, 'language.content_settings.node.') !== FALSE) {
$overrides[$config_name] = [
'default_langcode' => 'site_default',
Expand Down
6 changes: 3 additions & 3 deletions tests/Behat/DrupalContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public function iShouldNotSeeTheField(string $field): void {
}

/**
* Check that we have correct language for initial translation.
* Check that we have the correct language for initial translation.
*
* @param string $title
* Title of node.
Expand All @@ -242,7 +242,7 @@ public function iShouldNotSeeTheField(string $field): void {
public function assertOnlyDefaultLanguageTranslationExist(string $title): void {
$node = $this->getEntityByLabel('node', $title);
if (!$node) {
throw new \RuntimeException("Node '{$title}' is not exist.");
throw new \RuntimeException("Node '{$title}' doesn't exist.");
}

$node_translation_languages = $node->getTranslationLanguages();
Expand All @@ -252,7 +252,7 @@ public function assertOnlyDefaultLanguageTranslationExist(string $title): void {

$node_language = key($node_translation_languages);
if ($node_language != \Drupal::languageManager()->getDefaultLanguage()->getId()) {
throw new \RuntimeException("Original translation language of the '{$title}' node is not equal to site's default language.");
throw new \RuntimeException("Original translation language of the '{$title}' node is not the site's default language.");
}
}

Expand Down

0 comments on commit f5058de

Please sign in to comment.