function OgTranslationTestCase::addLanguage in Organic groups 7
Install a the specified language if it has not been already. Otherwise make sure that the language is enabled.
Parameters
string $language_code The language code the check.:
1 call to OgTranslationTestCase::addLanguage()
- OgTranslationTestCase::testOgNodeLocale in ./
og.test - Test disabling OG fields on translated content.
File
- ./
og.test, line 958
Class
- OgTranslationTestCase
- Test the multilangual groups.
Code
function addLanguage($language_code) {
// Check to make sure that language has not already been installed.
$this
->drupalGet('admin/config/regional/language');
if (strpos($this
->drupalGetContent(), 'enabled[' . $language_code . ']') === FALSE) {
// Doesn't have language installed so add it.
$edit = array();
$edit['langcode'] = $language_code;
$this
->drupalPost('admin/config/regional/language/add', $edit, t('Add language'));
// Make sure we're not using a stale list.
drupal_static_reset('language_list');
$languages = language_list('language');
}
elseif ($this
->xpath('//input[@type="checkbox" and @name=:name and @checked="checked"]', array(
':name' => 'enabled[' . $language_code . ']',
))) {
// It's installed and enabled. No need to do anything.
}
else {
// It's installed but not enabled. Enable it.
$this
->drupalPost(NULL, array(
'enabled[' . $language_code . ']' => TRUE,
), t('Save configuration'));
}
}