summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-10-16 15:47:46 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-10-16 15:47:46 +0000
commitd854417e0c05d65ed6f211906f851998640469f3 (patch)
treec8f3554f8717e19bfe9cee11aeed8e516d26bab1
parent5a89fef970b26af6eb1d970ad8a9a5876e4126df (diff)
downloadbrdo-d854417e0c05d65ed6f211906f851998640469f3.tar.gz
brdo-d854417e0c05d65ed6f211906f851998640469f3.tar.bz2
#565480 follow-up by plach: Clean-ups and documentation.
-rw-r--r--includes/language.inc2
-rw-r--r--modules/field/field.multilingual.inc2
-rw-r--r--modules/locale/locale.api.php19
-rw-r--r--modules/locale/locale.test9
4 files changed, 27 insertions, 5 deletions
diff --git a/includes/language.inc b/includes/language.inc
index 2fff7f3ba..77b8146be 100644
--- a/includes/language.inc
+++ b/includes/language.inc
@@ -424,7 +424,7 @@ function language_fallback_get_candidates($type = LANGUAGE_TYPE_CONTENT) {
$fallback_candidates[] = FIELD_LANGUAGE_NONE;
// 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;
diff --git a/modules/field/field.multilingual.inc b/modules/field/field.multilingual.inc
index a929439c6..e24c88692 100644
--- a/modules/field/field.multilingual.inc
+++ b/modules/field/field.multilingual.inc
@@ -10,7 +10,7 @@
* Implement hook_multilingual_settings_changed().
*/
function field_multilingual_settings_changed() {
- cache_clear_all('field_info_types', 'cache_field');
+ field_info_cache_clear();
}
/**
diff --git a/modules/locale/locale.api.php b/modules/locale/locale.api.php
index 461f459a4..c454c69a4 100644
--- a/modules/locale/locale.api.php
+++ b/modules/locale/locale.api.php
@@ -138,9 +138,26 @@ function hook_language_negotiation_info_alter(array &$language_providers) {
/**
* 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() {
- 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);
}
/**
diff --git a/modules/locale/locale.test b/modules/locale/locale.test
index 57413ec33..9a22b9abc 100644
--- a/modules/locale/locale.test
+++ b/modules/locale/locale.test
@@ -1296,6 +1296,7 @@ class LocalePathFunctionalTest extends DrupalWebTestCase {
$this->drupalLogout();
}
}
+
/**
* Functional tests for multilingual support on nodes.
*/
@@ -1417,8 +1418,6 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase {
}
}
-
-
/**
* Test UI language negotiation
* 1. URL (PATH) > DEFAULT
@@ -1621,6 +1620,9 @@ class UILanguageNegotiationTest extends DrupalWebTestCase {
}
}
+/**
+ * Functional test for multilingual fields.
+ */
class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase {
public static function getInfo() {
return array(
@@ -1634,6 +1636,9 @@ class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase {
parent::setUp('locale');
}
+ /**
+ * Test if field languages are correctly set through the node form.
+ */
function testMultilingualNodeForm() {
// Setup users.
$admin_user = $this->drupalCreateUser(array('administer languages', 'administer content types', 'access administration pages', 'create page content', 'edit own page content'));