protected function SimplenewsI18nTest::setUpLanguages in Simplenews 8.2
Same name and namespace in other branches
- 3.x tests/src/Functional/SimplenewsI18nTest.php \Drupal\Tests\simplenews\Functional\SimplenewsI18nTest::setUpLanguages()
Set up configuration for multiple languages.
1 call to SimplenewsI18nTest::setUpLanguages()
- SimplenewsI18nTest::setUp in tests/
src/ Functional/ SimplenewsI18nTest.php
File
- tests/
src/ Functional/ SimplenewsI18nTest.php, line 63
Class
- SimplenewsI18nTest
- Translation of newsletters and issues.
Namespace
Drupal\Tests\simplenews\FunctionalCode
protected function setUpLanguages() {
// Add languages.
$this->defaultLanguage = 'en';
$this->secondaryLanguage = 'es';
$this
->addLanguage($this->secondaryLanguage);
// Display the language widget.
$config = ContentLanguageSettings::loadByEntityTypeBundle('node', 'simplenews_issue');
$config
->setLanguageAlterable(TRUE);
$config
->save();
// Make Simplenews issue translatable.
\Drupal::service('content_translation.manager')
->setEnabled('node', 'simplenews_issue', TRUE);
drupal_static_reset();
\Drupal::entityTypeManager()
->clearCachedDefinitions();
\Drupal::service('router.builder')
->rebuild();
// Make Simplenews issue body translatable.
$field = FieldConfig::loadByName('node', 'simplenews_issue', 'body');
$field
->setTranslatable(TRUE);
$field
->save();
$this
->rebuildContainer();
}