Commit d854417e authored by webchick's avatar webchick

#565480 follow-up by plach: Clean-ups and documentation.

parent 5a89fef9
...@@ -424,7 +424,7 @@ function language_fallback_get_candidates($type = LANGUAGE_TYPE_CONTENT) { ...@@ -424,7 +424,7 @@ function language_fallback_get_candidates($type = LANGUAGE_TYPE_CONTENT) {
$fallback_candidates[] = FIELD_LANGUAGE_NONE; $fallback_candidates[] = FIELD_LANGUAGE_NONE;
// Let other modules hook in and add/change candidates. // Let other modules hook in and add/change candidates.
drupal_alter('language_get_fallback_candidates', $fallback_candidates); drupal_alter('language_fallback_candidates', $fallback_candidates);
} }
return $fallback_candidates; return $fallback_candidates;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* Implement hook_multilingual_settings_changed(). * Implement hook_multilingual_settings_changed().
*/ */
function field_multilingual_settings_changed() { function field_multilingual_settings_changed() {
cache_clear_all('field_info_types', 'cache_field'); field_info_cache_clear();
} }
/** /**
......
...@@ -138,9 +138,26 @@ function hook_language_negotiation_info_alter(array &$language_providers) { ...@@ -138,9 +138,26 @@ function hook_language_negotiation_info_alter(array &$language_providers) {
/** /**
* Allow modules to react to language settings changes. * Allow modules to react to language settings changes.
*
* Every module needing to act when the number of enabled languages changes
* should implement this. This is an "internal" hook and should not be invoked
* elsewhere. The typical implementation would trigger some kind of rebuilding,
* this way system components could properly react to the change of the enabled
* languages number.
*/ */
function hook_multilingual_settings_changed() { function hook_multilingual_settings_changed() {
cache_clear_all('field_info_types', 'cache_field'); field_info_cache_clear();
}
/**
* Perform alterations on the language fallback candidates.
*
* @param $fallback_candidates
* An array of language codes whose order will determine the language fallback
* order.
*/
function hook_language_fallback_candidates_alter(array &$fallback_candidates) {
$fallback_candidates = array_reverse($fallback_candidates);
} }
/** /**
......
...@@ -1296,6 +1296,7 @@ class LocalePathFunctionalTest extends DrupalWebTestCase { ...@@ -1296,6 +1296,7 @@ class LocalePathFunctionalTest extends DrupalWebTestCase {
$this->drupalLogout(); $this->drupalLogout();
} }
} }
/** /**
* Functional tests for multilingual support on nodes. * Functional tests for multilingual support on nodes.
*/ */
...@@ -1417,8 +1418,6 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase { ...@@ -1417,8 +1418,6 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase {
} }
} }
/** /**
* Test UI language negotiation * Test UI language negotiation
* 1. URL (PATH) > DEFAULT * 1. URL (PATH) > DEFAULT
...@@ -1621,6 +1620,9 @@ class UILanguageNegotiationTest extends DrupalWebTestCase { ...@@ -1621,6 +1620,9 @@ class UILanguageNegotiationTest extends DrupalWebTestCase {
} }
} }
/**
* Functional test for multilingual fields.
*/
class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase { class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase {
public static function getInfo() { public static function getInfo() {
return array( return array(
...@@ -1634,6 +1636,9 @@ class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase { ...@@ -1634,6 +1636,9 @@ class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase {
parent::setUp('locale'); parent::setUp('locale');
} }
/**
* Test if field languages are correctly set through the node form.
*/
function testMultilingualNodeForm() { function testMultilingualNodeForm() {
// Setup users. // Setup users.
$admin_user = $this->drupalCreateUser(array('administer languages', 'administer content types', 'access administration pages', 'create page content', 'edit own page content')); $admin_user = $this->drupalCreateUser(array('administer languages', 'administer content types', 'access administration pages', 'create page content', 'edit own page content'));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment