summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-12-02 19:26:23 +0000
committerDries Buytaert <dries@buytaert.net>2009-12-02 19:26:23 +0000
commit0baad49d620d9988837287cb5942eea764d3ed6f (patch)
tree146072f69b433cb7922572ba2ac627a83987edd4
parentef4513651e210784ba84eb310cf919e26f668bed (diff)
downloadbrdo-0baad49d620d9988837287cb5942eea764d3ed6f.tar.gz
brdo-0baad49d620d9988837287cb5942eea764d3ed6f.tar.bz2
- Patch #635094 by plach: unify 'language neutral' language codes.
-rw-r--r--includes/bootstrap.inc7
-rw-r--r--includes/language.inc2
-rw-r--r--includes/path.inc23
-rw-r--r--modules/aggregator/aggregator.test2
-rw-r--r--modules/blog/blog.test6
-rw-r--r--modules/book/book.admin.inc4
-rw-r--r--modules/book/book.module8
-rw-r--r--modules/book/book.pages.inc6
-rw-r--r--modules/book/book.test12
-rw-r--r--modules/comment/comment.module2
-rw-r--r--modules/comment/comment.pages.inc2
-rw-r--r--modules/comment/comment.tokens.inc2
-rw-r--r--modules/dblog/dblog.test6
-rw-r--r--modules/field/field.api.php2
-rw-r--r--modules/field/field.module7
-rw-r--r--modules/field/field.multilingual.inc14
-rw-r--r--modules/field/modules/field_sql_storage/field_sql_storage.test12
-rw-r--r--modules/field/modules/list/list.test28
-rw-r--r--modules/field/modules/options/options.test10
-rw-r--r--modules/field/modules/text/text.test6
-rw-r--r--modules/field/tests/field.test64
-rw-r--r--modules/field_ui/field_ui.admin.inc12
-rw-r--r--modules/field_ui/field_ui.test2
-rw-r--r--modules/file/tests/file.test42
-rw-r--r--modules/filter/filter.test2
-rw-r--r--modules/forum/forum.module4
-rw-r--r--modules/forum/forum.test8
-rw-r--r--modules/locale/locale.field.inc2
-rw-r--r--modules/locale/locale.module2
-rw-r--r--modules/locale/locale.test12
-rw-r--r--modules/menu/menu.module2
-rw-r--r--modules/menu/menu.test4
-rw-r--r--modules/node/node.admin.inc14
-rw-r--r--modules/node/node.install18
-rw-r--r--modules/node/node.module32
-rw-r--r--modules/node/node.pages.inc24
-rw-r--r--modules/node/node.test66
-rw-r--r--modules/node/node.tokens.inc6
-rw-r--r--modules/path/path.admin.inc6
-rw-r--r--modules/path/path.module14
-rw-r--r--modules/path/path.test16
-rw-r--r--modules/php/php.test6
-rw-r--r--modules/poll/poll.module4
-rw-r--r--modules/poll/poll.pages.inc4
-rw-r--r--modules/poll/poll.test4
-rw-r--r--modules/search/search.api.php4
-rw-r--r--modules/search/search.test16
-rw-r--r--modules/simpletest/drupal_web_test_case.php8
-rw-r--r--modules/simpletest/tests/common.test2
-rw-r--r--modules/statistics/statistics.pages.inc2
-rw-r--r--modules/system/system.api.php2
-rw-r--r--modules/system/system.install10
-rw-r--r--modules/system/system.test24
-rw-r--r--modules/system/system.tokens.inc2
-rw-r--r--modules/taxonomy/taxonomy.test8
-rw-r--r--modules/tracker/tracker.test42
-rw-r--r--modules/translation/translation.module6
-rw-r--r--modules/translation/translation.pages.inc4
-rw-r--r--modules/translation/translation.test6
-rw-r--r--modules/trigger/trigger.test2
-rw-r--r--modules/upload/upload.test6
61 files changed, 346 insertions, 329 deletions
diff --git a/includes/bootstrap.inc b/includes/bootstrap.inc
index 48b287546..012d89d1d 100644
--- a/includes/bootstrap.inc
+++ b/includes/bootstrap.inc
@@ -179,6 +179,13 @@ define('DRUPAL_AUTHENTICATED_RID', 2);
define('DRUPAL_KILOBYTE', 1024);
/**
+ * The language code used when no language is explicitly assigned.
+ *
+ * Defined by ISO639-2 for "No linguistic content / Not applicable".
+ */
+define('LANGUAGE_NONE', 'zxx');
+
+/**
* The type of language used to define the content language.
*/
define('LANGUAGE_TYPE_CONTENT', 'language');
diff --git a/includes/language.inc b/includes/language.inc
index bb4802df5..ec9c0f719 100644
--- a/includes/language.inc
+++ b/includes/language.inc
@@ -380,7 +380,7 @@ function language_fallback_get_candidates($type = LANGUAGE_TYPE_CONTENT) {
}
$fallback_candidates = array_keys($fallback_candidates);
- $fallback_candidates[] = FIELD_LANGUAGE_NONE;
+ $fallback_candidates[] = LANGUAGE_NONE;
// Let other modules hook in and add/change candidates.
drupal_alter('language_fallback_candidates', $fallback_candidates);
diff --git a/includes/path.inc b/includes/path.inc
index 12214daad..00c907204 100644
--- a/includes/path.inc
+++ b/includes/path.inc
@@ -43,7 +43,7 @@ function drupal_path_initialize() {
* Either a Drupal system path, an aliased path, or FALSE if no path was
* found.
*/
-function drupal_lookup_path($action, $path = '', $path_language = '') {
+function drupal_lookup_path($action, $path = '', $path_language = NULL) {
global $language;
// Use the advanced drupal_static() pattern, since this is called very often.
static $drupal_static = array();
@@ -90,9 +90,10 @@ function drupal_lookup_path($action, $path = '', $path_language = '') {
// Now fetch the aliases corresponding to these system paths.
// We order by ASC and overwrite array keys to ensure the correct
// alias is used when there are multiple aliases per path.
- $cache['map'][$path_language] = db_query("SELECT source, alias FROM {url_alias} WHERE source IN (:system) AND language IN (:language, '') ORDER BY language ASC, pid ASC", array(
+ $cache['map'][$path_language] = db_query("SELECT source, alias FROM {url_alias} WHERE source IN (:system) AND language IN (:language, :language_none) ORDER BY language ASC, pid ASC", array(
':system' => $cache['system_paths'],
- ':language' => $path_language
+ ':language' => $path_language,
+ ':language_none' => LANGUAGE_NONE,
))->fetchAllKeyed();
// Keep a record of paths with no alias to avoid querying twice.
$cache['no_aliases'][$path_language] = array_flip(array_diff_key($cache['system_paths'], array_keys($cache['map'][$path_language])));
@@ -111,9 +112,10 @@ function drupal_lookup_path($action, $path = '', $path_language = '') {
// For system paths which were not cached, query aliases individually.
else if (!isset($cache['no_aliases'][$path_language][$path])) {
// Get the most fitting result falling back with alias without language
- $alias = db_query("SELECT alias FROM {url_alias} WHERE source = :source AND language IN (:language, '') ORDER BY language DESC, pid DESC", array(
+ $alias = db_query("SELECT alias FROM {url_alias} WHERE source = :source AND language IN (:language, :language_none) ORDER BY language DESC, pid DESC", array(
':source' => $path,
- ':language' => $path_language
+ ':language' => $path_language,
+ ':language_none' => LANGUAGE_NONE,
))->fetchField();
$cache['map'][$path_language][$path] = $alias;
return $alias;
@@ -126,9 +128,10 @@ function drupal_lookup_path($action, $path = '', $path_language = '') {
$source = '';
if (!isset($cache['map'][$path_language]) || !($source = array_search($path, $cache['map'][$path_language]))) {
// Get the most fitting result falling back with alias without language
- if ($source = db_query("SELECT source FROM {url_alias} WHERE alias = :alias AND language IN (:language, '') ORDER BY language DESC, pid DESC", array(
+ if ($source = db_query("SELECT source FROM {url_alias} WHERE alias = :alias AND language IN (:language, :language_none) ORDER BY language DESC, pid DESC", array(
':alias' => $path,
- ':language' => $path_language))
+ ':language' => $path_language,
+ ':language_none' => LANGUAGE_NONE))
->fetchField()) {
$cache['map'][$path_language][$source] = $path;
}
@@ -186,7 +189,7 @@ function drupal_cache_system_paths() {
* An aliased path if one was found, or the original path if no alias was
* found.
*/
-function drupal_get_path_alias($path = NULL, $path_language = '') {
+function drupal_get_path_alias($path = NULL, $path_language = NULL) {
// If no path is specified, use the current page's path.
if ($path == NULL) {
$path = $_GET['q'];
@@ -210,7 +213,7 @@ function drupal_get_path_alias($path = NULL, $path_language = '') {
* The internal path represented by the alias, or the original alias if no
* internal path was found.
*/
-function drupal_get_normal_path($path, $path_language = '') {
+function drupal_get_normal_path($path, $path_language = NULL) {
$original_path = $path;
// Lookup the path alias first.
@@ -445,7 +448,7 @@ function path_load($conditions) {
* - language: (optional) The language of the alias.
*/
function path_save(&$path) {
- $path += array('pid' => NULL, 'language' => '');
+ $path += array('pid' => NULL, 'language' => LANGUAGE_NONE);
// Insert or update the alias.
$status = drupal_write_record('url_alias', $path, (!empty($path['pid']) ? 'pid' : NULL));
diff --git a/modules/aggregator/aggregator.test b/modules/aggregator/aggregator.test
index 17934ca50..92c2c10b8 100644
--- a/modules/aggregator/aggregator.test
+++ b/modules/aggregator/aggregator.test
@@ -249,7 +249,7 @@ EOF;
}
function createSampleNodes() {
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
// Post 5 articles.
for ($i = 0; $i < 5; $i++) {
$edit = array();
diff --git a/modules/blog/blog.test b/modules/blog/blog.test
index 2d0028522..9a3734d4d 100644
--- a/modules/blog/blog.test
+++ b/modules/blog/blog.test
@@ -138,20 +138,20 @@ class BlogTestCase extends DrupalWebTestCase {
// View blog node.
$this->drupalGet('node/' . $node->nid);
$this->assertResponse(200);
- $this->assertTitle($node->title[FIELD_LANGUAGE_NONE][0]['value'] . ' | Drupal', t('Blog node was displayed'));
+ $this->assertTitle($node->title[LANGUAGE_NONE][0]['value'] . ' | Drupal', t('Blog node was displayed'));
$this->assertText(t('Home ' . $crumb . ' Blogs ' . $crumb . ' @name' . $quote . 's blog', array('@name' => format_username($node_user))), t('Breadcrumbs were displayed'));
// View blog edit node.
$this->drupalGet('node/' . $node->nid . '/edit');
$this->assertResponse($response);
if ($response == 200) {
- $this->assertTitle('Edit Blog entry ' . $node->title[FIELD_LANGUAGE_NONE][0]['value'] . ' | Drupal', t('Blog edit node was displayed'));
+ $this->assertTitle('Edit Blog entry ' . $node->title[LANGUAGE_NONE][0]['value'] . ' | Drupal', t('Blog edit node was displayed'));
}
if ($response == 200) {
// Edit blog node.
$edit = array();
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$edit["title[$langcode][0][value]"] = 'node/' . $node->nid;
$edit["body[$langcode][0][value]"] = $this->randomName(256);
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
diff --git a/modules/book/book.admin.inc b/modules/book/book.admin.inc
index 81a07637f..52e67d36e 100644
--- a/modules/book/book.admin.inc
+++ b/modules/book/book.admin.inc
@@ -72,7 +72,7 @@ function book_admin_settings_validate($form, &$form_state) {
* @ingroup forms.
*/
function book_admin_edit($form, $form_state, $node) {
- drupal_set_title($node->title[FIELD_LANGUAGE_NONE][0]['value']);
+ drupal_set_title($node->title[LANGUAGE_NONE][0]['value']);
$form['#node'] = $node;
_book_admin_table($node, $form);
$form['save'] = array(
@@ -125,7 +125,7 @@ function book_admin_edit_submit($form, &$form_state) {
// Update the title if changed.
if ($row['title']['#default_value'] != $values['title']) {
$node = node_load($values['nid'], FALSE);
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$node->title = array($langcode => array(array('value' => $values['title'])));
$node->book['link_title'] = $values['title'];
$node->revision = 1;
diff --git a/modules/book/book.module b/modules/book/book.module
index a653261d3..bcb0682db 100644
--- a/modules/book/book.module
+++ b/modules/book/book.module
@@ -501,7 +501,7 @@ function _book_add_form_elements(&$form, &$form_state, $node) {
if (isset($node->nid) && ($nid == $node->book['original_bid']) && ($node->book['parent_depth_limit'] == 0)) {
// This is the top level node in a maximum depth book and thus cannot be moved.
- $options[$node->nid] = $node->title[FIELD_LANGUAGE_NONE][0]['value'];
+ $options[$node->nid] = $node->title[LANGUAGE_NONE][0]['value'];
}
else {
foreach (book_get_books() as $book) {
@@ -550,7 +550,7 @@ function _book_update_outline($node) {
$new = empty($node->book['mlid']);
$node->book['link_path'] = 'node/' . $node->nid;
- $node->book['link_title'] = $node->title[FIELD_LANGUAGE_NONE][0]['value'];
+ $node->book['link_title'] = $node->title[LANGUAGE_NONE][0]['value'];
$node->book['parent_mismatch'] = FALSE; // The normal case.
if ($node->book['bid'] == $node->nid) {
@@ -906,7 +906,7 @@ function book_form_node_delete_confirm_alter(&$form, $form_state) {
if (isset($node->book) && $node->book['has_children']) {
$form['book_warning'] = array(
- '#markup' => '<p>' . t('%title is part of a book outline, and has associated child pages. If you proceed with deletion, the child pages will be relocated automatically.', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])) . '</p>',
+ '#markup' => '<p>' . t('%title is part of a book outline, and has associated child pages. If you proceed with deletion, the child pages will be relocated automatically.', array('%title' => $node->title[LANGUAGE_NONE][0]['value'])) . '</p>',
'#weight' => -10,
);
}
@@ -1129,7 +1129,7 @@ function book_node_export($node, $children = '') {
*/
function template_preprocess_book_node_export_html(&$variables) {
$variables['depth'] = $variables['node']->book['depth'];
- $variables['title'] = check_plain($variables['node']->title[FIELD_LANGUAGE_NONE][0]['value']);
+ $variables['title'] = check_plain($variables['node']->title[LANGUAGE_NONE][0]['value']);
$variables['content'] = $variables['node']->rendered;
}
diff --git a/modules/book/book.pages.inc b/modules/book/book.pages.inc
index 76454aa9f..4fab15465 100644
--- a/modules/book/book.pages.inc
+++ b/modules/book/book.pages.inc
@@ -79,7 +79,7 @@ function book_export_html($nid) {
$contents = book_export_traverse($tree, 'book_node_export');
}
- return theme('book_export_html', array('title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'], 'contents' => $contents, 'depth' => $node->book['depth']));
+ return theme('book_export_html', array('title' => $node->title[LANGUAGE_NONE][0]['value'], 'contents' => $contents, 'depth' => $node->book['depth']));
}
else {
drupal_access_denied();
@@ -90,7 +90,7 @@ function book_export_html($nid) {
* Menu callback; show the outline form for a single node.
*/
function book_outline($node) {
- drupal_set_title($node->title[FIELD_LANGUAGE_NONE][0]['value']);
+ drupal_set_title($node->title[LANGUAGE_NONE][0]['value']);
return drupal_get_form('book_outline_form', $node);
}
@@ -188,7 +188,7 @@ function book_outline_form_submit($form, &$form_state) {
*/
function book_remove_form($form, &$form_state, $node) {
$form['#node'] = $node;
- $title = array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']);
+ $title = array('%title' => $node->title[LANGUAGE_NONE][0]['value']);
if ($node->book['has_children']) {
$description = t('%title has associated child pages, which will be relocated automatically to maintain their connection to the book. To recreate the hierarchy (as it was before removing this page), %title may be added again using the Outline tab, and each of its former child pages will need to be relocated manually.', $title);
diff --git a/modules/book/book.test b/modules/book/book.test
index 9a0f9a476..c051e73fb 100644
--- a/modules/book/book.test
+++ b/modules/book/book.test
@@ -110,7 +110,7 @@ class BookTestCase extends DrupalWebTestCase {
// Check previous, up, and next links.
if ($previous) {
- $this->assertRaw(l('‹ ' . $previous->title[FIELD_LANGUAGE_NONE][0]['value'], 'node/' . $previous->nid, array('attributes' => array('class' => array('page-previous'), 'title' => t('Go to previous page')))), t('Previous page link found.'));
+ $this->assertRaw(l('‹ ' . $previous->title[LANGUAGE_NONE][0]['value'], 'node/' . $previous->nid, array('attributes' => array('class' => array('page-previous'), 'title' => t('Go to previous page')))), t('Previous page link found.'));
}
if ($up) {
@@ -118,7 +118,7 @@ class BookTestCase extends DrupalWebTestCase {
}
if ($next) {
- $this->assertRaw(l($next->title[FIELD_LANGUAGE_NONE][0]['value'] . ' ›', 'node/' . $next->nid, array('attributes' => array('class' => array('page-next'), 'title' => t('Go to next page')))), t('Next page link found.'));
+ $this->assertRaw(l($next->title[LANGUAGE_NONE][0]['value'] . ' ›', 'node/' . $next->nid, array('attributes' => array('class' => array('page-next'), 'title' => t('Go to next page')))), t('Next page link found.'));
}
// Compute the expected breadcrumb.
@@ -140,8 +140,8 @@ class BookTestCase extends DrupalWebTestCase {
// Check printer friendly version.
$this->drupalGet('book/export/html/' . $node->nid);
- $this->assertText($node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Printer friendly title found.'));
- $this->assertRaw(check_markup($node->body[FIELD_LANGUAGE_NONE][0]['value'], $node->body[FIELD_LANGUAGE_NONE][0]['format']), t('Printer friendly body found.'));
+ $this->assertText($node->title[LANGUAGE_NONE][0]['value'], t('Printer friendly title found.'));
+ $this->assertRaw(check_markup($node->body[LANGUAGE_NONE][0]['value'], $node->body[LANGUAGE_NONE][0]['format']), t('Printer friendly body found.'));
$number++;
}
@@ -154,7 +154,7 @@ class BookTestCase extends DrupalWebTestCase {
function generateOutlinePattern($nodes) {
$outline = '';
foreach ($nodes as $node) {
- $outline .= '(node\/' . $node->nid . ')(.*?)(' . $node->title[FIELD_LANGUAGE_NONE][0]['value'] . ')(.*?)';
+ $outline .= '(node\/' . $node->nid . ')(.*?)(' . $node->title[LANGUAGE_NONE][0]['value'] . ')(.*?)';
}
return '/<div id="book-navigation-' . $this->book->nid . '"(.*?)<ul(.*?)' . $outline . '<\/ul>/s';
@@ -172,7 +172,7 @@ class BookTestCase extends DrupalWebTestCase {
static $number = 0; // Used to ensure that when sorted nodes stay in same order.
$edit = array();
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$edit["title[$langcode][0][value]"] = $number . ' - SimpleTest test node ' . $this->randomName(10);
$edit["body[$langcode][0][value]"] = 'SimpleTest test body ' . $this->randomName(32) . ' ' . $this->randomName(32);
$edit['book[bid]'] = $book_nid;
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index 583cefb80..2ff6d5e15 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -1672,7 +1672,7 @@ function comment_form($form, &$form_state, $comment) {
'comment' => '',
'cid' => NULL,
'pid' => NULL,
- 'language' => '',
+ 'language' => LANGUAGE_NONE,
'uid' => 0,
);
$comment = (object) $comment;
diff --git a/modules/comment/comment.pages.inc b/modules/comment/comment.pages.inc
index 72b490497..b3b36f6a3 100644
--- a/modules/comment/comment.pages.inc
+++ b/modules/comment/comment.pages.inc
@@ -29,7 +29,7 @@
*/
function comment_reply($node, $pid = NULL) {
// Set the breadcrumb trail.
- drupal_set_breadcrumb(array(l(t('Home'), NULL), l($node->title[FIELD_LANGUAGE_NONE][0]['value'], 'node/' . $node->nid)));
+ drupal_set_breadcrumb(array(l(t('Home'), NULL), l($node->title[LANGUAGE_NONE][0]['value'], 'node/' . $node->nid)));
$op = isset($_POST['op']) ? $_POST['op'] : '';
$build = array();
diff --git a/modules/comment/comment.tokens.inc b/modules/comment/comment.tokens.inc
index e22aea4fd..044b02bee 100644
--- a/modules/comment/comment.tokens.inc
+++ b/modules/comment/comment.tokens.inc
@@ -209,7 +209,7 @@ function comment_tokens($type, $tokens, array $data = array(), array $options =
case 'node':
$node = node_load($comment->nid);
- $title = $node->title[FIELD_LANGUAGE_NONE][0]['value'];
+ $title = $node->title[LANGUAGE_NONE][0]['value'];
$replacements[$original] = $sanitize ? filter_xss($title) : $title;
break;
}
diff --git a/modules/dblog/dblog.test b/modules/dblog/dblog.test
index c86d45e9a..b49b18d97 100644
--- a/modules/dblog/dblog.test
+++ b/modules/dblog/dblog.test
@@ -266,7 +266,7 @@ class DBLogTestCase extends DrupalWebTestCase {
// Create node using form to generate add content event (which is not triggered by drupalCreateNode).
$edit = $this->getContent($type);
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$title = $edit["title[$langcode][0][value]"];
$this->drupalPost('node/add/' . $type, $edit, t('Save'));
$this->assertResponse(200);
@@ -321,7 +321,7 @@ class DBLogTestCase extends DrupalWebTestCase {
* @return array Content.
*/
private function getContent($type) {
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
switch ($type) {
case 'poll':
$content = array(
@@ -357,7 +357,7 @@ class DBLogTestCase extends DrupalWebTestCase {
break;
default:
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$content = array(
"body[$langcode][0][value]" => $this->randomName(32),
);
diff --git a/modules/field/field.api.php b/modules/field/field.api.php
index ba2ca1d13..ea0d70b2a 100644
--- a/modules/field/field.api.php
+++ b/modules/field/field.api.php
@@ -1360,7 +1360,7 @@ function hook_field_storage_pre_insert($obj_type, $object, &$skip_fields) {
foreach ($language as $delta) {
$query->values(array(
'nid' => $object->nid,
- 'title' => $object->title[FIELD_LANGUAGE_NONE][0]['value'],
+ 'title' => $object->title[LANGUAGE_NONE][0]['value'],
'tid' => $delta['value'],
'sticky' => $object->sticky,
'created' => $object->created,
diff --git a/modules/field/field.module b/modules/field/field.module
index ccbbdf07a..a8769bde0 100644
--- a/modules/field/field.module
+++ b/modules/field/field.module
@@ -70,13 +70,6 @@ module_load_include('inc', 'field', 'field.form');
define('FIELD_CARDINALITY_UNLIMITED', -1);
/**
- * The language code assigned to untranslatable fields.
- *
- * Defined by ISO639-2 for "No linguistic content / Not applicable".
- */
-define('FIELD_LANGUAGE_NONE', 'zxx');
-
-/**
* TODO
*/
define('FIELD_BEHAVIOR_NONE', 0x0001);
diff --git a/modules/field/field.multilingual.inc b/modules/field/field.multilingual.inc
index 7ba6650d2..d492b358d 100644
--- a/modules/field/field.multilingual.inc
+++ b/modules/field/field.multilingual.inc
@@ -18,7 +18,7 @@ function field_multilingual_settings_changed() {
*
* If an entity has a translation handler and the given field is translatable,
* a (not necessarily strict) subset of the current enabled languages will be
- * returned, otherwise only FIELD_LANGUAGE_NONE will be returned. Since the
+ * returned, otherwise only LANGUAGE_NONE will be returned. Since the
* default value for a 'translatable' entity property is FALSE, we ensure that
* only entities that are able to handle translations actually get translatable
* fields.
@@ -58,7 +58,7 @@ function field_multilingual_available_languages($obj_type, $field, $suggested_la
}
}
else {
- $result = $field_languages[$field_name] = array(FIELD_LANGUAGE_NONE);
+ $result = $field_languages[$field_name] = array(LANGUAGE_NONE);
}
}
else {
@@ -71,13 +71,13 @@ function field_multilingual_available_languages($obj_type, $field, $suggested_la
/**
* Return available content languages.
*
- * The languages that may be associated to fields include FIELD_LANGAUGE_NONE.
+ * The languages that may be associated to fields include LANGUAGE_NONE.
*
* @return
* An array of language codes.
*/
function field_multilingual_content_languages() {
- return array_keys(language_list() + array(FIELD_LANGUAGE_NONE => NULL));
+ return array_keys(language_list() + array(LANGUAGE_NONE => NULL));
}
/**
@@ -132,12 +132,6 @@ function field_multilingual_valid_language($langcode, $default = TRUE) {
if (in_array($langcode, $enabled_languages)) {
return $langcode;
}
- // @todo Currently, node language neutral code is an empty string. Node passes
- // $node->language as language parameter to field_attach_form(). We might
- // want to unify the two "language neutral" language codes.
- if ($langcode === '') {
- return FIELD_LANGUAGE_NONE;
- }
global $language;
$langcode = $default ? language_default('language') : $language->language;
if (in_array($langcode, $enabled_languages)) {
diff --git a/modules/field/modules/field_sql_storage/field_sql_storage.test b/modules/field/modules/field_sql_storage/field_sql_storage.test
index 842bcf850..3c0650b85 100644
--- a/modules/field/modules/field_sql_storage/field_sql_storage.test
+++ b/modules/field/modules/field_sql_storage/field_sql_storage.test
@@ -57,7 +57,7 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
function testFieldAttachLoad() {
$entity_type = 'test_entity';
$eid = 0;
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$etid = _field_sql_storage_etid($entity_type);
$columns = array('etid', 'entity_id', 'revision_id', 'delta', 'language', $this->field_name . '_value');
@@ -126,7 +126,7 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
function testFieldAttachInsertAndUpdate() {
$entity_type = 'test_entity';
$entity = field_test_create_stub_entity(0, 0, $this->instance['bundle']);
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
// Test insert.
$values = array();
@@ -207,7 +207,7 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
function testFieldAttachSaveMissingData() {
$entity_type = 'test_entity';
$entity = field_test_create_stub_entity(0, 0, $this->instance['bundle']);
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
// Insert: Field is missing
field_attach_insert($entity_type, $entity);
@@ -306,7 +306,7 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
$instance = array('field_name' => 'decimal52', 'object_type' => 'test_entity', 'bundle' => 'test_bundle');
$instance = field_create_instance($instance);
$entity = field_test_create_stub_entity(0, 0, $instance['bundle']);
- $entity->decimal52[FIELD_LANGUAGE_NONE][0]['value'] = '1.235';
+ $entity->decimal52[LANGUAGE_NONE][0]['value'] = '1.235';
field_attach_insert('test_entity', $entity);
// Attempt to update the field in a way that would work without data.
@@ -344,7 +344,7 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
// Add data so the table cannot be dropped.
$entity = field_test_create_stub_entity(0, 0, $instance['bundle']);
- $entity->{$field_name}[FIELD_LANGUAGE_NONE][0]['value'] = 'field data';
+ $entity->{$field_name}[LANGUAGE_NONE][0]['value'] = 'field data';
field_attach_insert('test_entity', $entity);
// Add an index
@@ -367,7 +367,7 @@ class FieldSqlStorageTestCase extends DrupalWebTestCase {
// Verify that the tables were not dropped.
$entity = field_test_create_stub_entity(0, 0, $instance['bundle']);
field_attach_load('test_entity', array(0 => $entity));
- $this->assertEqual($entity->{$field_name}[FIELD_LANGUAGE_NONE][0]['value'], 'field data', t("Index changes performed without dropping the tables"));
+ $this->assertEqual($entity->{$field_name}[LANGUAGE_NONE][0]['value'], 'field data', t("Index changes performed without dropping the tables"));
}
}
diff --git a/modules/field/modules/list/list.test b/modules/field/modules/list/list.test
index de9c29e41..684b60ec3 100644
--- a/modules/field/modules/list/list.test
+++ b/modules/field/modules/list/list.test
@@ -42,28 +42,28 @@ class ListFieldTestCase extends DrupalWebTestCase {
// All three options appear.
$entity = field_test_create_stub_entity();
$form = drupal_get_form('field_test_entity_form', $entity);
- $this->assertTrue(!empty($form['card_1'][FIELD_LANGUAGE_NONE][1]), t('Option 1 exists'));
- $this->assertTrue(!empty($form['card_1'][FIELD_LANGUAGE_NONE][2]), t('Option 2 exists'));
- $this->assertTrue(!empty($form['card_1'][FIELD_LANGUAGE_NONE][3]), t('Option 3 exists'));
+ $this->assertTrue(!empty($form['card_1'][LANGUAGE_NONE][1]), t('Option 1 exists'));
+ $this->assertTrue(!empty($form['card_1'][LANGUAGE_NONE][2]), t('Option 2 exists'));
+ $this->assertTrue(!empty($form['card_1'][LANGUAGE_NONE][3]), t('Option 3 exists'));
// Removed options do not appear.
$this->card_1['settings']['allowed_values'] = "2|Two";
field_update_field($this->card_1);
$entity = field_test_create_stub_entity();
$form = drupal_get_form('field_test_entity_form', $entity);
- $this->assertTrue(empty($form['card_1'][FIELD_LANGUAGE_NONE][1]), t('Option 1 does not exist'));
- $this->assertTrue(!empty($form['card_1'][FIELD_LANGUAGE_NONE][2]), t('Option 2 exists'));
- $this->assertTrue(empty($form['card_1'][FIELD_LANGUAGE_NONE][3]), t('Option 3 does not exist'));
+ $this->assertTrue(empty($form['card_1'][LANGUAGE_NONE][1]), t('Option 1 does not exist'));
+ $this->assertTrue(!empty($form['card_1'][LANGUAGE_NONE][2]), t('Option 2 exists'));
+ $this->assertTrue(empty($form['card_1'][LANGUAGE_NONE][3]), t('Option 3 does not exist'));
// Completely new options appear.
$this->card_1['settings']['allowed_values'] = "10|Update\n20|Twenty";
field_update_field($this->card_1);
$form = drupal_get_form('field_test_entity_form', $entity);
- $this->assertTrue(empty($form['card_1'][FIELD_LANGUAGE_NONE][1]), t('Option 1 does not exist'));
- $this->assertTrue(empty($form['card_1'][FIELD_LANGUAGE_NONE][2]), t('Option 2 does not exist'));
- $this->assertTrue(empty($form['card_1'][FIELD_LANGUAGE_NONE][3]), t('Option 3 does not exist'));
- $this->assertTrue(!empty($form['card_1'][FIELD_LANGUAGE_NONE][10]), t('Option 10 exists'));
- $this->assertTrue(!empty($form['card_1'][FIELD_LANGUAGE_NONE][20]), t('Option 20 exists'));
+ $this->assertTrue(empty($form['card_1'][LANGUAGE_NONE][1]), t('Option 1 does not exist'));
+ $this->assertTrue(empty($form['card_1'][LANGUAGE_NONE][2]), t('Option 2 does not exist'));
+ $this->assertTrue(empty($form['card_1'][LANGUAGE_NONE][3]), t('Option 3 does not exist'));
+ $this->assertTrue(!empty($form['card_1'][LANGUAGE_NONE][10]), t('Option 10 exists'));
+ $this->assertTrue(!empty($form['card_1'][LANGUAGE_NONE][20]), t('Option 20 exists'));
// Options are reset when a new field with the same name is created.
field_delete_field($this->card_1['field_name']);
@@ -81,9 +81,9 @@ class ListFieldTestCase extends DrupalWebTestCase {
$this->instance_1 = field_create_instance($this->instance_1);
$entity = field_test_create_stub_entity();
$form = drupal_get_form('field_test_entity_form', $entity);
- $this->assertTrue(!empty($form['card_1'][FIELD_LANGUAGE_NONE][1]), t('Option 1 exists'));
- $this->assertTrue(!empty($form['card_1'][FIELD_LANGUAGE_NONE][2]), t('Option 2 exists'));
- $this->assertTrue(!empty($form['card_1'][FIELD_LANGUAGE_NONE][3]), t('Option 3 exists'));
+ $this->assertTrue(!empty($form['card_1'][LANGUAGE_NONE][1]), t('Option 1 exists'));
+ $this->assertTrue(!empty($form['card_1'][LANGUAGE_NONE][2]), t('Option 2 exists'));
+ $this->assertTrue(!empty($form['card_1'][LANGUAGE_NONE][3]), t('Option 3 exists'));
}
}
diff --git a/modules/field/modules/options/options.test b/modules/field/modules/options/options.test
index 4d343b880..5abee73f3 100644
--- a/modules/field/modules/options/options.test
+++ b/modules/field/modules/options/options.test
@@ -68,7 +68,7 @@ class OptionsWidgetsTestCase extends DrupalWebTestCase {
),
);
$instance = field_create_instance($instance);
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
// Create an entity.
$entity_init = field_test_create_stub_entity();
@@ -124,7 +124,7 @@ class OptionsWidgetsTestCase extends DrupalWebTestCase {
),
);
$instance = field_create_instance($instance);
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
// Create an entity.
$entity_init = field_test_create_stub_entity();
@@ -210,7 +210,7 @@ class OptionsWidgetsTestCase extends DrupalWebTestCase {
),
);
$instance = field_create_instance($instance);
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
// Create an entity.
$entity_init = field_test_create_stub_entity();
@@ -264,7 +264,7 @@ class OptionsWidgetsTestCase extends DrupalWebTestCase {
),
);
$instance = field_create_instance($instance);
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
// Create an entity.
$entity_init = field_test_create_stub_entity();
@@ -347,7 +347,7 @@ class OptionsWidgetsTestCase extends DrupalWebTestCase {
),
);
$instance = field_create_instance($instance);
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
// Create an entity.
$entity_init = field_test_create_stub_entity();
diff --git a/modules/field/modules/text/text.test b/modules/field/modules/text/text.test
index d6dc58acf..3fb419f14 100644
--- a/modules/field/modules/text/text.test
+++ b/modules/field/modules/text/text.test
@@ -54,7 +54,7 @@ class TextFieldTestCase extends DrupalWebTestCase {
field_create_instance($this->instance);
// Test valid and invalid values with field_attach_validate().
$entity = field_test_create_stub_entity();
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
for ($i = 0; $i <= $max_length + 2; $i++) {
$entity->{$this->field['field_name']}[$langcode][0]['value'] = str_repeat('x', $i);
try {
@@ -97,7 +97,7 @@ class TextFieldTestCase extends DrupalWebTestCase {
)
);
field_create_instance($this->instance);
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
// Display creation form.
$this->drupalGet('test-entity/add/test-bundle');
@@ -151,7 +151,7 @@ class TextFieldTestCase extends DrupalWebTestCase {
)
);
field_create_instance($this->instance);
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
// Delete all text formats besides the plain text fallback format.
$this->drupalLogin($this->admin_user);
diff --git a/modules/field/tests/field.test b/modules/field/tests/field.test
index 5d7a847b9..a0290c1eb 100644
--- a/modules/field/tests/field.test
+++ b/modules/field/tests/field.test
@@ -97,7 +97,7 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
// field_test_field_load() in field_test.module).
$this->instance['settings']['test_hook_field_load'] = TRUE;
field_update_instance($this->instance);
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$entity_type = 'test_entity';
$values = array();
@@ -154,7 +154,7 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
*/
function testFieldAttachLoadMultiple() {
$entity_type = 'test_entity';
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
// Define 2 bundles.
$bundles = array(
@@ -230,7 +230,7 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
*/
function testFieldAttachSaveLoadDifferentStorage() {
$entity_type = 'test_entity';
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
// Create two fields using different storage backends, and their instances.
$fields = array(
@@ -324,7 +324,7 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
function testFieldAttachSaveMissingData() {
$entity_type = 'test_entity';
$entity_init = field_test_create_stub_entity();
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
// Insert: Field is missing.
$entity = clone($entity_init);
@@ -406,7 +406,7 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
$entity_type = 'test_entity';
$entity_init = field_test_create_stub_entity();
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
// Insert: Field is NULL.
$entity = clone($entity_init);
@@ -433,7 +433,7 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
*/
function testFieldAttachDelete() {
$entity_type = 'test_entity';
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$rev[0] = field_test_create_stub_entity(0, 0, $this->instance['bundle']);
// Create revision 0
@@ -498,7 +498,7 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
// Save an object with data in the field.
$entity = field_test_create_stub_entity(0, 0, $this->instance['bundle']);
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$values = $this->_generateTestFieldValues($this->field['cardinality']);
$entity->{$this->field_name}[$langcode] = $values;
$entity_type = 'test_entity';
@@ -557,7 +557,7 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
// Save an object with data for both fields
$entity = field_test_create_stub_entity(0, 0, $this->instance['bundle']);
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$values = $this->_generateTestFieldValues($this->field['cardinality']);
$entity->{$this->field_name}[$langcode] = $values;
$entity->{$field_name}[$langcode] = $this->_generateTestFieldValues(1);
@@ -589,7 +589,7 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
*/
function testFieldAttachQuery() {
$cardinality = $this->field['cardinality'];
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
// Create an additional bundle with an instance of the field.
field_test_create_bundle('test_bundle_1', 'Test Bundle 1');
@@ -740,7 +740,7 @@ class FieldAttachStorageTestCase extends FieldAttachTestCase {
// Create first object revision with random (distinct) values.
$entity_type = 'test_entity';
$entities = array(1 => field_test_create_stub_entity(1, 1), 2 => field_test_create_stub_entity(1, 2));
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$values = array();
for ($delta = 0; $delta < $cardinality; $delta++) {
do {
@@ -812,7 +812,7 @@ class FieldAttachOtherTestCase extends FieldAttachTestCase {
function testFieldAttachView() {
$entity_type = 'test_entity';
$entity_init = field_test_create_stub_entity();
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
// Populate values to be displayed.
$values = $this->_generateTestFieldValues($this->field['cardinality']);
@@ -937,7 +937,7 @@ class FieldAttachOtherTestCase extends FieldAttachTestCase {
function testFieldAttachCache() {
// Initialize random values and a test entity.
$entity_init = field_test_create_stub_entity(1, 1, $this->instance['bundle']);
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$values = $this->_generateTestFieldValues($this->field['cardinality']);
// Non-cacheable entity type.
@@ -1029,7 +1029,7 @@ class FieldAttachOtherTestCase extends FieldAttachTestCase {
function testFieldAttachValidate() {
$entity_type = 'test_entity';
$entity = field_test_create_stub_entity(0, 0, $this->instance['bundle']);
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
// Set up values to generate errors
$values = array();
@@ -1075,7 +1075,7 @@ class FieldAttachOtherTestCase extends FieldAttachTestCase {
$form_state = form_state_defaults();
field_attach_form($entity_type, $entity, $form, $form_state);
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$this->assertEqual($form[$this->field_name][$langcode]['#title'], $this->instance['label'], "Form title is {$this->instance['label']}");
for ($delta = 0; $delta < $this->field['cardinality']; $delta++) {
// field_test_widget uses 'textfield'
@@ -1110,7 +1110,7 @@ class FieldAttachOtherTestCase extends FieldAttachTestCase {
// Leave an empty value. 'field_test' fields are empty if empty().
$values[1]['value'] = 0;
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$form_state['values'] = array($this->field_name => array($langcode => $values));
field_attach_submit($entity_type, $entity, $form, $form_state);
@@ -1375,7 +1375,7 @@ class FieldFormTestCase extends FieldTestCase {
$this->instance['field_name'] = $this->field_name;
field_create_field($this->field);
field_create_instance($this->instance);
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
// Display creation form.
$this->drupalGet('test-entity/add/test-bundle');
@@ -1429,7 +1429,7 @@ class FieldFormTestCase extends FieldTestCase {
$this->instance['required'] = TRUE;
field_create_field($this->field);
field_create_instance($this->instance);
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
// Submit with missing required value.
$edit = array();
@@ -1467,7 +1467,7 @@ class FieldFormTestCase extends FieldTestCase {
$this->instance['field_name'] = $this->field_name;
field_create_field($this->field);
field_create_instance($this->instance);
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
// Display creation form -> 1 widget.
$this->drupalGet('test-entity/add/test-bundle');
@@ -1548,7 +1548,7 @@ class FieldFormTestCase extends FieldTestCase {
$this->instance['field_name'] = $this->field_name;
field_create_field($this->field);
field_create_instance($this->instance);
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
// Display creation form -> 1 widget.
$this->drupalGet('test-entity/add/test-bundle');
@@ -1623,7 +1623,7 @@ class FieldFormTestCase extends FieldTestCase {
field_create_field($field_no_access);
field_create_instance($instance_no_access);
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
// Display creation form.
$this->drupalGet('test-entity/add/test-bundle');
@@ -1944,7 +1944,7 @@ class FieldCrudTestCase extends FieldTestCase {
// Save an object with data for the field
$entity = field_test_create_stub_entity(0, 0, $instance['bundle']);
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$values[0]['value'] = mt_rand(1, 127);
$entity->{$field['field_name']}[$langcode] = $values;
$entity_type = 'test_entity';
@@ -2000,17 +2000,17 @@ class FieldCrudTestCase extends FieldTestCase {
// Save values with 2, 3, and 4 decimal places.
$entity = field_test_create_stub_entity(0, 0, $instance['bundle']);
- $entity->decimal53[FIELD_LANGUAGE_NONE][0]['value'] = '1.23';
- $entity->decimal53[FIELD_LANGUAGE_NONE][1]['value'] = '1.235';
- $entity->decimal53[FIELD_LANGUAGE_NONE][2]['value'] = '1.2355';
+ $entity->decimal53[LANGUAGE_NONE][0]['value'] = '1.23';
+ $entity->decimal53[LANGUAGE_NONE][1]['value'] = '1.235';
+ $entity->decimal53[LANGUAGE_NONE][2]['value'] = '1.2355';
field_attach_insert('test_entity', $entity);
$entity = field_test_create_stub_entity(0, 0, $instance['bundle']);
// Verify that the updated 5.3 field rounds to 3 decimal places.
field_attach_load('test_entity', array(0 => $entity));
- $this->assertEqual($entity->decimal53[FIELD_LANGUAGE_NONE][0]['value'], '1.23', t('2 decimal places are left alone'));
- $this->assertEqual($entity->decimal53[FIELD_LANGUAGE_NONE][1]['value'], '1.235', t('3 decimal places are left alone'));
- $this->assertEqual($entity->decimal53[FIELD_LANGUAGE_NONE][2]['value'], '1.236', t('4 decimal places are rounded to 3'));
+ $this->assertEqual($entity->decimal53[LANGUAGE_NONE][0]['value'], '1.23', t('2 decimal places are left alone'));
+ $this->assertEqual($entity->decimal53[LANGUAGE_NONE][1]['value'], '1.235', t('3 decimal places are left alone'));
+ $this->assertEqual($entity->decimal53[LANGUAGE_NONE][2]['value'], '1.236', t('4 decimal places are rounded to 3'));
}
/**
@@ -2360,7 +2360,7 @@ class FieldTranslationsTestCase extends FieldTestCase {
$langcode = language_default();
$suggested_languages = array($langcode->language);
$available_languages = field_multilingual_available_languages($this->obj_type, $field, $suggested_languages);
- $this->assertTrue(count($available_languages) == 1 && $available_languages[0] === FIELD_LANGUAGE_NONE, t('Untranslatable entity: suggested language ignored.'));
+ $this->assertTrue(count($available_languages) == 1 && $available_languages[0] === LANGUAGE_NONE, t('Untranslatable entity: suggested language ignored.'));
// Enable field translations for the entity.
field_test_entity_info_translatable('test_entity', TRUE);
@@ -2369,9 +2369,9 @@ class FieldTranslationsTestCase extends FieldTestCase {
$this->field['settings']['test_hook_in'] = TRUE;
$enabled_languages = array_keys(language_list());
$available_languages = field_multilingual_available_languages($this->obj_type, $this->field);
- $this->assertTrue(in_array(FIELD_LANGUAGE_NONE, $available_languages), t('%language is an available language.', array('%language' => FIELD_LANGUAGE_NONE)));
+ $this->assertTrue(in_array(LANGUAGE_NONE, $available_languages), t('%language is an available language.', array('%language' => LANGUAGE_NONE)));
foreach ($available_languages as $delta => $langcode) {
- if ($langcode != FIELD_LANGUAGE_NONE) {
+ if ($langcode != LANGUAGE_NONE) {
$this->assertTrue(in_array($langcode, $enabled_languages), t('%language is an enabled language.', array('%language' => $langcode)));
}
}
@@ -2382,7 +2382,7 @@ class FieldTranslationsTestCase extends FieldTestCase {
$this->field['translatable'] = FALSE;
$this->field_name = $this->field['field_name'] = $this->instance['field_name'] = drupal_strtolower($this->randomName() . '_field_name');
$available_languages = field_multilingual_available_languages($this->obj_type, $this->field);
- $this->assertTrue(count($available_languages) == 1 && $available_languages[0] === FIELD_LANGUAGE_NONE, t('For untranslatable fields only neutral language is available.'));
+ $this->assertTrue(count($available_languages) == 1 && $available_languages[0] === LANGUAGE_NONE, t('For untranslatable fields only neutral language is available.'));
// Test language suggestions.
$this->field['settings']['test_hook_in'] = FALSE;
@@ -2608,7 +2608,7 @@ class FieldBulkDeleteTestCase extends FieldTestCase {
for ($i = 0; $i < 10; $i++) {
$entity = field_test_create_stub_entity($id, $id, $bundle);
foreach ($this->fields as $field) {
- $entity->{$field['field_name']}[FIELD_LANGUAGE_NONE] = $this->_generateTestFieldValues($field['cardinality']);
+ $entity->{$field['field_name']}[LANGUAGE_NONE] = $this->_generateTestFieldValues($field['cardinality']);
}
$this->entities[$id] = $entity;
field_attach_insert($this->entity_type, $entity);
diff --git a/modules/field_ui/field_ui.admin.inc b/modules/field_ui/field_ui.admin.inc
index 1cf31a79b..fb07548c0 100644
--- a/modules/field_ui/field_ui.admin.inc
+++ b/modules/field_ui/field_ui.admin.inc
@@ -1211,7 +1211,7 @@ function field_ui_default_value_widget($field, $instance, &$form, &$form_state)
$instance['required'] = FALSE;
$instance['description'] = '';
// @todo Allow multiple values (requires more work on 'add more' JS handler).
- $element += field_default_form(NULL, NULL, $field, $instance, FIELD_LANGUAGE_NONE, $items, $form, $form_state, 0);
+ $element += field_default_form(NULL, NULL, $field, $instance, LANGUAGE_NONE, $items, $form, $form_state, 0);
// Adjust 'form_path' to reflect the actual location of the widget in the
// form structure.
@@ -1233,16 +1233,16 @@ function field_ui_field_edit_form_validate($form, &$form_state) {
// Extract field values.
$items = array();
$form_state_copy = array('values' => $instance['default_value_widget']);
- field_default_extract_form_values(NULL, NULL, $field, $instance, FIELD_LANGUAGE_NONE, $items, $form, $form_state_copy);
+ field_default_extract_form_values(NULL, NULL, $field, $instance, LANGUAGE_NONE, $items, $form, $form_state_copy);
// Validate the values and report errors.
$errors = array();
$function = $field['module'] . '_field_validate';
if (function_exists($function)) {
- $function(NULL, NULL, $field, $instance, FIELD_LANGUAGE_NONE, $items, $errors);
+ $function(NULL, NULL, $field, $instance, LANGUAGE_NONE, $items, $errors);
}
if ($errors) {
- field_default_form_errors(NULL, NULL, $field, $instance, FIELD_LANGUAGE_NONE, $items, $form, $errors);
+ field_default_form_errors(NULL, NULL, $field, $instance, LANGUAGE_NONE, $items, $form, $errors);
}
}
}
@@ -1264,10 +1264,10 @@ function field_ui_field_edit_form_submit($form, &$form_state) {
// Extract field values.
$items = array();
$form_state_copy = array('values' => $instance['default_value_widget']);
- field_default_extract_form_values(NULL, NULL, $field, $instance, FIELD_LANGUAGE_NONE, $items, $form, $form_state_copy);
+ field_default_extract_form_values(NULL, NULL, $field, $instance, LANGUAGE_NONE, $items, $form, $form_state_copy);
// Prepare field values.
- field_default_submit(NULL, NULL, $field, $instance, FIELD_LANGUAGE_NONE, $items, $form, $form_state_copy);
+ field_default_submit(NULL, NULL, $field, $instance, LANGUAGE_NONE, $items, $form, $form_state_copy);
$instance['default_value'] = $items ? $items : NULL;
unset($instance['default_value_widget']);
diff --git a/modules/field_ui/field_ui.test b/modules/field_ui/field_ui.test
index f9aaf975c..1dd82bd85 100644
--- a/modules/field_ui/field_ui.test
+++ b/modules/field_ui/field_ui.test
@@ -234,7 +234,7 @@ class FieldUITestCase extends DrupalWebTestCase {
);
field_create_instance($instance);
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$admin_path = 'admin/structure/types/manage/' . $this->hyphen_type . '/fields/' . $field_name;
$element_id = "edit-instance-default-value-widget-$field_name-$langcode-0-value";
$element_name = "instance[default_value_widget][$field_name][$langcode][0][value]";
diff --git a/modules/file/tests/file.test b/modules/file/tests/file.test
index d3444a585..64327b31d 100644
--- a/modules/file/tests/file.test
+++ b/modules/file/tests/file.test
@@ -88,7 +88,7 @@ class FileFieldTestCase extends DrupalWebTestCase {
* Upload a file to a node.
*/
function uploadNodeFile($file, $field_name, $nid_or_type, $new_revision = TRUE) {
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$edit = array(
"title[$langcode][0][value]" => $this->randomName(),
'revision' => (string) (int) $new_revision,
@@ -97,11 +97,11 @@ class FileFieldTestCase extends DrupalWebTestCase {
if (is_numeric($nid_or_type)) {
$node = node_load($nid_or_type);
$delta = isset($node->$field_name) ? count($node->$field_name) : 0;
- $edit['files[' . $field_name . '_' . FIELD_LANGUAGE_NONE . '_' . $delta . ']'] = realpath($file->uri);
+ $edit['files[' . $field_name . '_' . LANGUAGE_NONE . '_' . $delta . ']'] = realpath($file->uri);
$this->drupalPost('node/' . $nid_or_type . '/edit', $edit, t('Save'));
}
else {
- $edit['files[' . $field_name . '_' . FIELD_LANGUAGE_NONE . '_0]'] = realpath($file->uri);
+ $edit['files[' . $field_name . '_' . LANGUAGE_NONE . '_0]'] = realpath($file->uri);
$type_name = str_replace('_', '-', $nid_or_type);
$this->drupalPost('node/add/' . $type_name, $edit, t('Save'));
}
@@ -130,7 +130,7 @@ class FileFieldTestCase extends DrupalWebTestCase {
*/
function replaceNodeFile($file, $field_name, $nid, $new_revision = TRUE) {
$edit = array(
- 'files[' . $field_name . '_' . FIELD_LANGUAGE_NONE . '_0]' => realpath($file->uri),
+ 'files[' . $field_name . '_' . LANGUAGE_NONE . '_0]' => realpath($file->uri),
'revision' => (string) (int) $new_revision,
);
@@ -211,7 +211,7 @@ class FileFieldRevisionTestCase extends FileFieldTestCase {
// Check that the file exists on disk and in the database.
$node = node_load($nid, NULL, TRUE);
- $node_file_r1 = (object) $node->{$field_name}[FIELD_LANGUAGE_NONE][0];
+ $node_file_r1 = (object) $node->{$field_name}[LANGUAGE_NONE][0];
$node_vid_r1 = $node->vid;
$this->assertFileExists($node_file_r1, t('New file saved to disk on node creation.'));
$this->assertFileEntryExists($node_file_r1, t('File entry exists in database on node creation.'));
@@ -219,14 +219,14 @@ class FileFieldRevisionTestCase extends FileFieldTestCase {
// Upload another file to the same node in a new revision.
$this->replaceNodeFile($test_file, $field_name, $nid);
$node = node_load($nid, NULL, TRUE);
- $node_file_r2 = (object) $node->{$field_name}[FIELD_LANGUAGE_NONE][0];
+ $node_file_r2 = (object) $node->{$field_name}[LANGUAGE_NONE][0];
$node_vid_r2 = $node->vid;
$this->assertFileExists($node_file_r2, t('Replacement file exists on disk after creating new revision.'));
$this->assertFileEntryExists($node_file_r2, t('Replacement file entry exists in database after creating new revision.'));
// Check that the original file is still in place on the first revision.
$node = node_load($nid, $node_vid_r1, TRUE);
- $this->assertEqual($node_file_r1, (object) $node->{$field_name}[FIELD_LANGUAGE_NONE][0], t('Original file still in place after replacing file in new revision.'));
+ $this->assertEqual($node_file_r1, (object) $node->{$field_name}[LANGUAGE_NONE][0], t('Original file still in place after replacing file in new revision.'));
$this->assertFileExists($node_file_r1, t('Original file still in place after replacing file in new revision.'));
$this->assertFileEntryExists($node_file_r1, t('Original file entry still in place after replacing file in new revision'));
@@ -234,14 +234,14 @@ class FileFieldRevisionTestCase extends FileFieldTestCase {
// Check that the file is still the same as the previous revision.
$this->drupalPost('node/' . $nid . '/edit', array('revision' => '1'), t('Save'));
$node = node_load($nid, NULL, TRUE);
- $node_file_r3 = (object) $node->{$field_name}[FIELD_LANGUAGE_NONE][0];
+ $node_file_r3 = (object) $node->{$field_name}[LANGUAGE_NONE][0];
$node_vid_r3 = $node->vid;
$this->assertEqual($node_file_r2, $node_file_r3, t('Previous revision file still in place after creating a new revision without a new file.'));
// Revert to the first revision and check that the original file is active.
$this->drupalPost('node/' . $nid . '/revisions/' . $node_vid_r1 . '/revert', array(), t('Revert'));
$node = node_load($nid, NULL, TRUE);
- $node_file_r4 = (object) $node->{$field_name}[FIELD_LANGUAGE_NONE][0];
+ $node_file_r4 = (object) $node->{$field_name}[LANGUAGE_NONE][0];
$node_vid_r4 = $node->vid;
$this->assertEqual($node_file_r1, $node_file_r4, t('Original revision file still in place after reverting to the original revision.'));
@@ -305,12 +305,12 @@ class FileFieldDisplayTestCase extends FileFieldTestCase {
// Check that the default formatter is displaying with the file name.
$node = node_load($nid, NULL, TRUE);
- $node_file = (object) $node->{$field_name}[FIELD_LANGUAGE_NONE][0];
+ $node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
$default_output = theme('file_link', array('file' => $node_file));
$this->assertRaw($default_output, t('Default formatter displaying correctly on full node view.'));
// Turn the "display" option off and check that the file is no longer displayed.
- $edit = array($field_name . '[' . FIELD_LANGUAGE_NONE . '][0][display]' => FALSE);
+ $edit = array($field_name . '[' . LANGUAGE_NONE . '][0][display]' => FALSE);
$this->drupalPost('node/' . $nid . '/edit', $edit, t('Save'));
$this->assertNoRaw($default_output, t('Field is hidden when "display" option is unchecked.'));
@@ -346,7 +346,7 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
$test_file = $this->getTestFile('text');
// Try to post a new node without uploading a file.
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$edit = array("title[$langcode][0][value]" => $this->randomName());
$this->drupalPost('node/add/' . $type_name, $edit, t('Save'));
$this->assertRaw(t('!title field is required.', array('!title' => $instance['label'])), t('Node save failed when required file field was empty.'));
@@ -355,7 +355,7 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
$node = node_load($nid, NULL, TRUE);
- $node_file = (object) $node->{$field_name}[FIELD_LANGUAGE_NONE][0];
+ $node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
$this->assertFileExists($node_file, t('File exists after uploading to the required field.'));
$this->assertFileEntryExists($node_file, t('File entry exists after uploading to the required field.'));
@@ -371,7 +371,7 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
// Create a new node with the uploaded file into the multivalue field.
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
$node = node_load($nid, NULL, TRUE);
- $node_file = (object) $node->{$field_name}[FIELD_LANGUAGE_NONE][0];
+ $node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
$this->assertFileExists($node_file, t('File exists after uploading to the required multiple value field.'));
$this->assertFileEntryExists($node_file, t('File entry exists after uploading to the required multipel value field.'));
@@ -407,7 +407,7 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
// Create a new node with the small file, which should pass.
$nid = $this->uploadNodeFile($small_file, $field_name, $type_name);
$node = node_load($nid, NULL, TRUE);
- $node_file = (object) $node->{$field_name}[FIELD_LANGUAGE_NONE][0];
+ $node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
$this->assertFileExists($node_file, t('File exists after uploading a file (%filesize) under the max limit (%maxsize).', array('%filesize' => format_size($small_file->filesize), '%maxsize' => $max_filesize)));
$this->assertFileEntryExists($node_file, t('File entry exists after uploading a file (%filesize) under the max limit (%maxsize).', array('%filesize' => format_size($small_file->filesize), '%maxsize' => $max_filesize)));
@@ -423,7 +423,7 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
// Upload the big file successfully.
$nid = $this->uploadNodeFile($large_file, $field_name, $type_name);
$node = node_load($nid, NULL, TRUE);
- $node_file = (object) $node->{$field_name}[FIELD_LANGUAGE_NONE][0];
+ $node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
$this->assertFileExists($node_file, t('File exists after uploading a file (%filesize) with no max limit.', array('%filesize' => format_size($large_file->filesize))));
$this->assertFileEntryExists($node_file, t('File entry exists after uploading a file (%filesize) with no max limit.', array('%filesize' => format_size($large_file->filesize))));
@@ -450,7 +450,7 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
// Check that the file can be uploaded with no extension checking.
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
$node = node_load($nid, NULL, TRUE);
- $node_file = (object) $node->{$field_name}[FIELD_LANGUAGE_NONE][0];
+ $node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
$this->assertFileExists($node_file, t('File exists after uploading a file with no extension checking.'));
$this->assertFileEntryExists($node_file, t('File entry exists after uploading a file with no extension checking.'));
@@ -468,7 +468,7 @@ class FileFieldValidateTestCase extends FileFieldTestCase {
// Check that the file can be uploaded with extension checking.
$nid = $this->uploadNodeFile($test_file, $field_name, $type_name);
$node = node_load($nid, NULL, TRUE);
- $node_file = (object) $node->{$field_name}[FIELD_LANGUAGE_NONE][0];
+ $node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
$this->assertFileExists($node_file, t('File exists after uploading a file with extension checking.'));
$this->assertFileEntryExists($node_file, t('File entry exists after uploading a file with extension checking.'));
@@ -503,7 +503,7 @@ class FileFieldPathTestCase extends FileFieldTestCase {
// Check that the file was uploaded to the file root.
$node = node_load($nid, NULL, TRUE);
- $node_file = (object) $node->{$field_name}[FIELD_LANGUAGE_NONE][0];
+ $node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
$this->assertPathMatch('public://' . $test_file->filename, $node_file->uri, t('The file %file was uploaded to the correct path.', array('%file' => $node_file->uri)));
// Change the path to contain multiple subdirectories.
@@ -514,7 +514,7 @@ class FileFieldPathTestCase extends FileFieldTestCase {
// Check that the file was uploaded into the subdirectory.
$node = node_load($nid, NULL, TRUE);
- $node_file = (object) $node->{$field_name}[FIELD_LANGUAGE_NONE][0];
+ $node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
$this->assertPathMatch('public://foo/bar/baz/' . $test_file->filename, $node_file->uri, t('The file %file was uploaded to the correct path.', array('%file' => $node_file->uri)));
// Check the path when used with tokens.
@@ -526,7 +526,7 @@ class FileFieldPathTestCase extends FileFieldTestCase {
// Check that the file was uploaded into the subdirectory.
$node = node_load($nid, NULL, TRUE);
- $node_file = (object) $node->{$field_name}[FIELD_LANGUAGE_NONE][0];
+ $node_file = (object) $node->{$field_name}[LANGUAGE_NONE][0];
$data = array('user' => $this->admin_user);
$subdirectory = token_replace('[user:uid]/[user:name]', $data);
$this->assertPathMatch('public://' . $subdirectory . '/' . $test_file->filename, $node_file->uri, t('The file %file was uploaded to the correct path with token replacements.', array('%file' => $node_file->uri)));
diff --git a/modules/filter/filter.test b/modules/filter/filter.test
index bcdf2d4f5..a7302c8da 100644
--- a/modules/filter/filter.test
+++ b/modules/filter/filter.test
@@ -319,7 +319,7 @@ class FilterAdminTestCase extends DrupalWebTestCase {
$text = $body . '<random>' . $extra_text . '</random>';
$edit = array();
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$edit["title[$langcode][0][value]"] = $this->randomName();
$edit["body[$langcode][0][value]"] = $text;
$edit["body[$langcode][0][value_format]"] = $filtered;
diff --git a/modules/forum/forum.module b/modules/forum/forum.module
index e1c45700a..8aa51713a 100644
--- a/modules/forum/forum.module
+++ b/modules/forum/forum.module
@@ -431,7 +431,7 @@ function forum_field_storage_pre_insert($obj_type, $object, &$skip_fields) {
foreach ($language as $item) {
$query->values(array(
'nid' => $object->nid,
- 'title' => $object->title[FIELD_LANGUAGE_NONE][0]['value'],
+ 'title' => $object->title[LANGUAGE_NONE][0]['value'],
'tid' => $item['tid'],
'sticky' => $object->sticky,
'created' => $object->created,
@@ -465,7 +465,7 @@ function forum_field_storage_pre_update($obj_type, $object, &$skip_fields) {
foreach ($language as $item) {
$query->values(array(
'nid' => $object->nid,
- 'title' => $object->title[FIELD_LANGUAGE_NONE][0]['value'],
+ 'title' => $object->title[LANGUAGE_NONE][0]['value'],
'tid' => $item['tid'],
'sticky' => $object->sticky,
'created' => $object->created,
diff --git a/modules/forum/forum.test b/modules/forum/forum.test
index eadfaaa77..ae900307b 100644
--- a/modules/forum/forum.test
+++ b/modules/forum/forum.test
@@ -263,7 +263,7 @@ class ForumTestCase extends DrupalWebTestCase {
// select items list.
$tid = $forum['tid'];
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$edit = array(
"title[$langcode][0][value]" => $title,
"body[$langcode][0][value]" => $body,
@@ -340,20 +340,20 @@ class ForumTestCase extends DrupalWebTestCase {
// View forum node.
$this->drupalGet('node/' . $node->nid);
$this->assertResponse(200);
- $this->assertTitle($node->title[FIELD_LANGUAGE_NONE][0]['value'] . ' | Drupal', t('Forum node was displayed'));
+ $this->assertTitle($node->title[LANGUAGE_NONE][0]['value'] . ' | Drupal', t('Forum node was displayed'));
$this->assertText(t('Home ' . $crumb . ' Forums ' . $crumb . ' @container ' . $crumb . ' @forum', array('@container' => $this->container['name'], '@forum' => $this->forum['name'])), t('Breadcrumbs were displayed'));
// View forum edit node.
$this->drupalGet('node/' . $node->nid . '/edit');
$this->assertResponse($response);
if ($response == 200) {
- $this->assertTitle('Edit Forum topic ' . $node->title[FIELD_LANGUAGE_NONE][0]['value'] . ' | Drupal', t('Forum edit node was displayed'));
+ $this->assertTitle('Edit Forum topic ' . $node->title[LANGUAGE_NONE][0]['value'] . ' | Drupal', t('Forum edit node was displayed'));
}
if ($response == 200) {
// Edit forum node (including moving it to another forum).
$edit = array();
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$edit["title[$langcode][0][value]"] = 'node/' . $node->nid;
$edit["body[$langcode][0][value]"] = $this->randomName(256);
// Assume the topic is initially associated with $forum.
diff --git a/modules/locale/locale.field.inc b/modules/locale/locale.field.inc
index b304ce329..8093f3520 100644
--- a/modules/locale/locale.field.inc
+++ b/modules/locale/locale.field.inc
@@ -16,7 +16,7 @@ function locale_field_node_form_update_field_language($form, &$form_state, $rese
$node = (object) $form_state['values'];
$available_languages = field_multilingual_content_languages();
// @todo: Unify language neutral language codes.
- $selected_language = empty($node->language) ? FIELD_LANGUAGE_NONE : $node->language;
+ $selected_language = empty($node->language) ? LANGUAGE_NONE : $node->language;
list(, , $bundle) = entity_extract_ids('node', $node);
foreach (field_info_instances('node', $bundle) as $instance) {
diff --git a/modules/locale/locale.module b/modules/locale/locale.module
index 910f890ab..5c1c94300 100644
--- a/modules/locale/locale.module
+++ b/modules/locale/locale.module
@@ -412,7 +412,7 @@ function locale_form_alter(&$form, &$form_state, $form_id) {
'#type' => 'select',
'#title' => t('Language'),
'#default_value' => (isset($form['#node']->language) ? $form['#node']->language : ''),
- '#options' => array('' => t('Language neutral')) + locale_language_list('name'),
+ '#options' => array(LANGUAGE_NONE => t('Language neutral')) + locale_language_list('name'),
);
}
// Node type without language selector: assign the default for new nodes
diff --git a/modules/locale/locale.test b/modules/locale/locale.test
index 758cc9914..2d2d14153 100644
--- a/modules/locale/locale.test
+++ b/modules/locale/locale.test
@@ -1287,11 +1287,11 @@ class LocalePathFunctionalTest extends DrupalWebTestCase {
// Confirm English language path alias works.
$this->drupalGet($english_path);
- $this->assertText($node->title[FIELD_LANGUAGE_NONE][0]['value'], t('English alias works.'));
+ $this->assertText($node->title[LANGUAGE_NONE][0]['value'], t('English alias works.'));
// Confirm custom language path alias works.
$this->drupalGet($prefix . '/' . $custom_language_path);
- $this->assertText($node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Custom language alias works.'));
+ $this->assertText($node->title[LANGUAGE_NONE][0]['value'], t('Custom language alias works.'));
$this->drupalLogout();
}
@@ -1398,7 +1398,7 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase {
$node_body = $this->randomName();
$edit = array(
'type' => 'page',
- 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $node_title))),
+ 'title' => array(LANGUAGE_NONE => array(array('value' => $node_title))),
'body' => array($langcode => array(array('value' => $node_body))),
'language' => $langcode,
);
@@ -1657,7 +1657,7 @@ class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase {
*/
function testMultilingualNodeForm() {
// Create page content.
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$title_key = "title[$langcode][0][value]";
$title_value = $this->randomName(8);
$body_key = "body[$langcode][0][value]";
@@ -1674,7 +1674,7 @@ class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase {
$node = $this->drupalGetNodeByTitle($edit[$title_key]);
$this->assertTrue($node, t('Node found in database.'));
- $assert = isset($node->body['en']) && !isset($node->body[FIELD_LANGUAGE_NONE]) && $node->body['en'][0]['value'] == $body_value;
+ $assert = isset($node->body['en']) && !isset($node->body[LANGUAGE_NONE]) && $node->body['en'][0]['value'] == $body_value;
$this->assertTrue($assert, t('Field language correctly set.'));
// Change node language.
@@ -1696,7 +1696,7 @@ class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase {
*/
function testMultilingualDisplaySettings() {
// Create page content.
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$title_key = "title[$langcode][0][value]";
$title_value = $this->randomName(8);
$body_key = "body[$langcode][0][value]";
diff --git a/modules/menu/menu.module b/modules/menu/menu.module
index 93face4a6..5396d6ced 100644
--- a/modules/menu/menu.module
+++ b/modules/menu/menu.module
@@ -484,7 +484,7 @@ function menu_node_save($node) {
$link['link_path'] = "node/$node->nid";
// If not already set, use the node's title as link title attribute.
if (empty($link['options']['attributes']['title']) && !$link['customized']) {
- $link['options']['attributes']['title'] = trim($node->title[FIELD_LANGUAGE_NONE][0]['value']);
+ $link['options']['attributes']['title'] = trim($node->title[LANGUAGE_NONE][0]['value']);
}
if (!menu_link_save($link)) {
drupal_set_message(t('There was an error saving the menu link.'), 'error');
diff --git a/modules/menu/menu.test b/modules/menu/menu.test
index fbd3fe74f..d4a2772e6 100644
--- a/modules/menu/menu.test
+++ b/modules/menu/menu.test
@@ -315,7 +315,7 @@ class MenuTestCase extends DrupalWebTestCase {
// Verify menu link link.
$this->clickLink($title);
- $title = $parent_node->title[FIELD_LANGUAGE_NONE][0]['value'];
+ $title = $parent_node->title[LANGUAGE_NONE][0]['value'];
$this->assertTitle(t("@title | Drupal", array('@title' => $title)), t('Parent menu link link target was correct'));
}
@@ -325,7 +325,7 @@ class MenuTestCase extends DrupalWebTestCase {
// Verify menu link link.
$this->clickLink($title);
- $title = $item_node->title[FIELD_LANGUAGE_NONE][0]['value'];
+ $title = $item_node->title[LANGUAGE_NONE][0]['value'];
$this->assertTitle(t("@title | Drupal", array('@title' => $title)), t('Menu link link target was correct'));
}
diff --git a/modules/node/node.admin.inc b/modules/node/node.admin.inc
index dd4202f2a..e70ab1224 100644
--- a/modules/node/node.admin.inc
+++ b/modules/node/node.admin.inc
@@ -108,7 +108,7 @@ function node_filters() {
}
// Language filter if there is a list of languages
if ($languages = module_invoke('locale', 'language_list')) {
- $languages = array('' => t('Language neutral')) + $languages;
+ $languages = array(LANGUAGE_NONE => t('Language neutral')) + $languages;
$filters['language'] = array(
'title' => t('language'),
'options' => array(
@@ -169,7 +169,7 @@ function node_filter_form() {
$value = $value->name;
}
elseif ($type == 'language') {
- $value = empty($value) ? t('Language neutral') : module_invoke('locale', 'language_name', $value);
+ $value = $value == LANGUAGE_NONE ? t('Language neutral') : module_invoke('locale', 'language_name', $value);
}
else {
$value = $filters[$type]['options'][$value];
@@ -356,7 +356,7 @@ function _node_mass_update_batch_process($nodes, $updates, &$context) {
$node = _node_mass_update_helper($nid, $updates);
// Store result for post-processing in the finished callback.
- $context['results'][] = l($node->title[FIELD_LANGUAGE_NONE][0]['value'], 'node/' . $node->nid);
+ $context['results'][] = l($node->title[LANGUAGE_NONE][0]['value'], 'node/' . $node->nid);
// Update our progress information.
$context['sandbox']['progress']++;
@@ -436,7 +436,7 @@ function node_admin_nodes() {
// Enable language column if translation module is enabled
// or if we have any node with language.
- $multilanguage = (module_exists('translation') || db_query("SELECT COUNT(*) FROM {node} WHERE language <> ''")->fetchField());
+ $multilanguage = (module_exists('translation') || db_query("SELECT COUNT(*) FROM {node} WHERE language <> :language", array(':language' => LANGUAGE_NONE))->fetchField());
// Build the sortable table header.
$header = array(
@@ -482,12 +482,12 @@ function node_admin_nodes() {
$destination = drupal_get_destination();
$options = array();
foreach ($nodes as $node) {
- $l_options = !empty($node->language) ? array('language' => $languages[$node->language]) : array();
+ $l_options = $node->language != LANGUAGE_NONE ? array('language' => $languages[$node->language]) : array();
$options[$node->nid] = array(
'title' => array(
'data' => array(
'#type' => 'link',
- '#title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'],
+ '#title' => $node->title[LANGUAGE_NONE][0]['value'],
'#href' => 'node/' . $node->nid,
'#options' => $l_options,
'#suffix' => ' ' . theme('mark', array('type' => node_mark($node->nid, $node->changed))),
@@ -499,7 +499,7 @@ function node_admin_nodes() {
'changed' => format_date($node->changed, 'short'),
);
if ($multilanguage) {
- $options[$node->nid]['language'] = empty($node->language) ? t('Language neutral') : t($languages[$node->language]->name);
+ $options[$node->nid]['language'] = $node->language == LANGUAGE_NONE ? t('Language neutral') : t($languages[$node->language]->name);
}
// Build a list of all the accessible operations for the current node.
$operations = array();
diff --git a/modules/node/node.install b/modules/node/node.install
index 272c1fbd3..31ad1b238 100644
--- a/modules/node/node.install
+++ b/modules/node/node.install
@@ -490,21 +490,21 @@ function node_update_7006(&$context) {
'vid' => $revision->vid,
'type' => $revision->type,
);
- $node->title[FIELD_LANGUAGE_NONE][0]['value'] = $revision->title;
+ $node->title[LANGUAGE_NONE][0]['value'] = $revision->title;
if (!empty($revision->teaser) && $revision->teaser != text_summary($revision->body)) {
- $node->body[FIELD_LANGUAGE_NONE][0]['summary'] = $revision->teaser;
+ $node->body[LANGUAGE_NONE][0]['summary'] = $revision->teaser;
}
// Do this after text_summary() above.
$break = '<!--break-->';
if (substr($revision->body, 0, strlen($break)) == $break) {
$revision->body = substr($revision->body, strlen($break));
}
- $node->body[FIELD_LANGUAGE_NONE][0]['value'] = $revision->body;
+ $node->body[LANGUAGE_NONE][0]['value'] = $revision->body;
// Explicitly store the current default text format if the revision
// did not have its own text format. Similar conversions for other
// core modules are performed in filter_update_7005(), but we do this
// one here since we are already migrating the data.
- $node->body[FIELD_LANGUAGE_NONE][0]['format'] = !empty($revision->format) ? $revision->format : variable_get('filter_default_format', 1);
+ $node->body[LANGUAGE_NONE][0]['format'] = !empty($revision->format) ? $revision->format : variable_get('filter_default_format', 1);
// This is a core update and no contrib modules are enabled yet, so
// we can assume default field storage for a faster update.
field_sql_storage_field_storage_write('node', $node, FIELD_STORAGE_INSERT, array());
@@ -566,6 +566,16 @@ function node_update_7008() {
}
/**
+ * Convert node languages from the empty string to LANGUAGE_NONE.
+ */
+function node_update_7009() {
+ db_update('node')
+ ->fields(array('language' => LANGUAGE_NONE))
+ ->condition('language', '')
+ ->execute();
+}
+
+/**
* @} End of "defgroup updates-6.x-to-7.x"
* The next series of updates should start at 8000.
*/
diff --git a/modules/node/node.module b/modules/node/node.module
index 24ca6c4c3..753063b50 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -1004,7 +1004,7 @@ function node_save($node) {
// column. After this we restore the field data structure to the previous node
// title field.
$title_field = $node->title;
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$node->title = $title_field[$langcode][0]['value'];
// Generate the node table query and the node_revisions table query.
@@ -1239,7 +1239,7 @@ function node_build_content($node, $build_mode = 'full') {
$links['node_readmore'] = array(
'title' => t('Read more'),
'href' => 'node/' . $node->nid,
- 'attributes' => array('rel' => 'tag', 'title' => strip_tags($node->title[FIELD_LANGUAGE_NONE][0]['value']))
+ 'attributes' => array('rel' => 'tag', 'title' => strip_tags($node->title[LANGUAGE_NONE][0]['value']))
);
}
$node->content['links']['node'] = array(
@@ -1310,7 +1310,7 @@ function node_language_provider($languages) {
*/
function node_show($node, $message = FALSE) {
if ($message) {
- drupal_set_title(t('Revision of %title from %date', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'], '%date' => format_date($node->revision_timestamp))), PASS_THROUGH);
+ drupal_set_title(t('Revision of %title from %date', array('%title' => $node->title[LANGUAGE_NONE][0]['value'], '%date' => format_date($node->revision_timestamp))), PASS_THROUGH);
}
// Update the history table, stating that this user viewed this node.
@@ -1344,7 +1344,7 @@ function template_preprocess_node(&$variables) {
$variables['date'] = format_date($node->created);
$variables['name'] = theme('username', array('account' => $node));
$variables['node_url'] = url('node/' . $node->nid);
- $variables['node_title'] = check_plain($node->title[FIELD_LANGUAGE_NONE][0]['value']);
+ $variables['node_title'] = check_plain($node->title[LANGUAGE_NONE][0]['value']);
$variables['page'] = (bool)menu_get_object();
if (!empty($node->in_preview)) {
@@ -1591,7 +1591,7 @@ function node_search_execute($keys = NULL) {
$results[] = array(
'link' => url('node/' . $item->sid, array('absolute' => TRUE)),
'type' => check_plain(node_type_get_name($node)),
- 'title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'],
+ 'title' => $node->title[LANGUAGE_NONE][0]['value'],
'user' => theme('username', array('account' => $node)),
'date' => $node->changed,
'node' => $node,
@@ -2080,7 +2080,7 @@ function node_feed($nids = FALSE, $channel = array()) {
$item_text .= drupal_render($build);
}
- $items .= format_rss_item($node->title[FIELD_LANGUAGE_NONE][0]['value'], $node->link, $item_text, $node->rss_elements);
+ $items .= format_rss_item($node->title[LANGUAGE_NONE][0]['value'], $node->link, $item_text, $node->rss_elements);
}
$channel_defaults = array(
@@ -2225,7 +2225,7 @@ function _node_index_node($node) {
unset($build['#theme']);
$node->rendered = drupal_render($build);
- $text = '<h1>' . check_plain($node->title[FIELD_LANGUAGE_NONE][0]['value']) . '</h1>' . $node->rendered;
+ $text = '<h1>' . check_plain($node->title[LANGUAGE_NONE][0]['value']) . '</h1>' . $node->rendered;
// Fetch extra data normally not visible
$extra = module_invoke_all('node_update_index', $node);
@@ -3045,7 +3045,7 @@ function node_action_info() {
*/
function node_publish_action($node, $context = array()) {
$node->status = NODE_PUBLISHED;
- watchdog('action', 'Set @type %title to published.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
+ watchdog('action', 'Set @type %title to published.', array('@type' => node_type_get_name($node), '%title' => $node->title[LANGUAGE_NONE][0]['value']));
}
/**
@@ -3054,7 +3054,7 @@ function node_publish_action($node, $context = array()) {
*/
function node_unpublish_action($node, $context = array()) {
$node->status = NODE_NOT_PUBLISHED;
- watchdog('action', 'Set @type %title to unpublished.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
+ watchdog('action', 'Set @type %title to unpublished.', array('@type' => node_type_get_name($node), '%title' => $node->title[LANGUAGE_NONE][0]['value']));
}
/**
@@ -3063,7 +3063,7 @@ function node_unpublish_action($node, $context = array()) {
*/
function node_make_sticky_action($node, $context = array()) {
$node->sticky = NODE_STICKY;
- watchdog('action', 'Set @type %title to sticky.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
+ watchdog('action', 'Set @type %title to sticky.', array('@type' => node_type_get_name($node), '%title' => $node->title[LANGUAGE_NONE][0]['value']));
}
/**
@@ -3072,7 +3072,7 @@ function node_make_sticky_action($node, $context = array()) {
*/
function node_make_unsticky_action($node, $context = array()) {
$node->sticky = NODE_NOT_STICKY;
- watchdog('action', 'Set @type %title to unsticky.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
+ watchdog('action', 'Set @type %title to unsticky.', array('@type' => node_type_get_name($node), '%title' => $node->title[LANGUAGE_NONE][0]['value']));
}
/**
@@ -3081,7 +3081,7 @@ function node_make_unsticky_action($node, $context = array()) {
*/
function node_promote_action($node, $context = array()) {
$node->promote = NODE_PROMOTED;
- watchdog('action', 'Promoted @type %title to front page.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
+ watchdog('action', 'Promoted @type %title to front page.', array('@type' => node_type_get_name($node), '%title' => $node->title[LANGUAGE_NONE][0]['value']));
}
/**
@@ -3090,7 +3090,7 @@ function node_promote_action($node, $context = array()) {
*/
function node_unpromote_action($node, $context = array()) {
$node->promote = NODE_NOT_PROMOTED;
- watchdog('action', 'Removed @type %title from front page.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
+ watchdog('action', 'Removed @type %title from front page.', array('@type' => node_type_get_name($node), '%title' => $node->title[LANGUAGE_NONE][0]['value']));
}
/**
@@ -3099,7 +3099,7 @@ function node_unpromote_action($node, $context = array()) {
*/
function node_save_action($node) {
node_save($node);
- watchdog('action', 'Saved @type %title', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
+ watchdog('action', 'Saved @type %title', array('@type' => node_type_get_name($node), '%title' => $node->title[LANGUAGE_NONE][0]['value']));
}
/**
@@ -3109,7 +3109,7 @@ function node_save_action($node) {
function node_assign_owner_action($node, $context) {
$node->uid = $context['owner_uid'];
$owner_name = db_query("SELECT name FROM {users} WHERE uid = :uid", array(':uid' => $context['owner_uid']))->fetchField();
- watchdog('action', 'Changed owner of @type %title to uid %name.', array('@type' => node_type_get_type($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'], '%name' => $owner_name));
+ watchdog('action', 'Changed owner of @type %title to uid %name.', array('@type' => node_type_get_type($node), '%title' => $node->title[LANGUAGE_NONE][0]['value'], '%name' => $owner_name));
}
function node_assign_owner_action_form($context) {
@@ -3190,7 +3190,7 @@ function node_unpublish_by_keyword_action($node, $context) {
foreach ($context['keywords'] as $keyword) {
if (strpos(drupal_render(node_build(clone $node)), $keyword) !== FALSE || strpos($node->title, $keyword) !== FALSE) {
$node->status = NODE_NOT_PUBLISHED;
- watchdog('action', 'Set @type %title to unpublished.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
+ watchdog('action', 'Set @type %title to unpublished.', array('@type' => node_type_get_name($node), '%title' => $node->title[LANGUAGE_NONE][0]['value']));
break;
}
}
diff --git a/modules/node/node.pages.inc b/modules/node/node.pages.inc
index fe07fd15d..01f540002 100644
--- a/modules/node/node.pages.inc
+++ b/modules/node/node.pages.inc
@@ -12,7 +12,7 @@
*/
function node_page_edit($node) {
$type_name = node_type_get_name($node);
- drupal_set_title(t('<em>Edit @type</em> @title', array('@type' => $type_name, '@title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), PASS_THROUGH);
+ drupal_set_title(t('<em>Edit @type</em> @title', array('@type' => $type_name, '@title' => $node->title[LANGUAGE_NONE][0]['value'])), PASS_THROUGH);
return drupal_get_form($node->type . '_node_form', $node);
}
@@ -62,7 +62,7 @@ function node_add($type) {
// If a node type has been specified, validate its existence.
if (isset($types[$type])) {
// Initialize settings:
- $node = (object)array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => $type, 'language' => '');
+ $node = (object)array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => $type, 'language' => LANGUAGE_NONE);
drupal_set_title(t('Create @name', array('@name' => $types[$type]->name)), PASS_THROUGH);
$output = drupal_get_form($type . '_node_form', $node);
@@ -421,8 +421,8 @@ function node_form_submit($form, &$form_state) {
$insert = empty($node->nid);
node_save($node);
$node_link = l(t('view'), 'node/' . $node->nid);
- $watchdog_args = array('@type' => $node->type, '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']);
- $t_args = array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']);
+ $watchdog_args = array('@type' => $node->type, '%title' => $node->title[LANGUAGE_NONE][0]['value']);
+ $t_args = array('@type' => node_type_get_name($node), '%title' => $node->title[LANGUAGE_NONE][0]['value']);
if ($insert) {
watchdog('content', '@type: added %title.', $watchdog_args, WATCHDOG_NOTICE, $node_link);
@@ -472,7 +472,7 @@ function node_delete_confirm($form, &$form_state, $node) {
);
return confirm_form($form,
- t('Are you sure you want to delete %title?', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])),
+ t('Are you sure you want to delete %title?', array('%title' => $node->title[LANGUAGE_NONE][0]['value'])),
'node/' . $node->nid,
t('This action cannot be undone.'),
t('Delete'),
@@ -487,8 +487,8 @@ function node_delete_confirm_submit($form, &$form_state) {
if ($form_state['values']['confirm']) {
$node = node_load($form_state['values']['nid']);
node_delete($form_state['values']['nid']);
- watchdog('content', '@type: deleted %title.', array('@type' => $node->type, '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value']));
- drupal_set_message(t('@type %title has been deleted.', array('@type' => node_type_get_name($node), '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])));
+ watchdog('content', '@type: deleted %title.', array('@type' => $node->type, '%title' => $node->title[LANGUAGE_NONE][0]['value']));
+ drupal_set_message(t('@type %title has been deleted.', array('@type' => node_type_get_name($node), '%title' => $node->title[LANGUAGE_NONE][0]['value'])));
}
$form_state['redirect'] = '<front>';
@@ -498,7 +498,7 @@ function node_delete_confirm_submit($form, &$form_state) {
* Generate an overview table of older revisions of a node.
*/
function node_revision_overview($node) {
- drupal_set_title(t('Revisions for %title', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), PASS_THROUGH);
+ drupal_set_title(t('Revisions for %title', array('%title' => $node->title[LANGUAGE_NONE][0]['value'])), PASS_THROUGH);
$header = array(t('Revision'), array('data' => t('Operations'), 'colspan' => 2));
@@ -560,8 +560,8 @@ function node_revision_revert_confirm_submit($form, &$form_state) {
node_save($node_revision);
- watchdog('content', '@type: reverted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->title[FIELD_LANGUAGE_NONE][0]['value'], '%revision' => $node_revision->vid));
- drupal_set_message(t('@type %title has been reverted back to the revision from %revision-date.', array('@type' => node_type_get_name($node_revision), '%title' => $node_revision->title[FIELD_LANGUAGE_NONE][0]['value'], '%revision-date' => format_date($node_revision->revision_timestamp))));
+ watchdog('content', '@type: reverted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->title[LANGUAGE_NONE][0]['value'], '%revision' => $node_revision->vid));
+ drupal_set_message(t('@type %title has been reverted back to the revision from %revision-date.', array('@type' => node_type_get_name($node_revision), '%title' => $node_revision->title[LANGUAGE_NONE][0]['value'], '%revision-date' => format_date($node_revision->revision_timestamp))));
$form_state['redirect'] = 'node/' . $node_revision->nid . '/revisions';
}
@@ -574,8 +574,8 @@ function node_revision_delete_confirm_submit($form, &$form_state) {
$node_revision = $form['#node_revision'];
node_revision_delete($node_revision->vid);
- watchdog('content', '@type: deleted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->title[FIELD_LANGUAGE_NONE][0]['value'], '%revision' => $node_revision->vid));
- drupal_set_message(t('Revision from %revision-date of @type %title has been deleted.', array('%revision-date' => format_date($node_revision->revision_timestamp), '@type' => node_type_get_name($node_revision), '%title' => $node_revision->title[FIELD_LANGUAGE_NONE][0]['value'])));
+ watchdog('content', '@type: deleted %title revision %revision.', array('@type' => $node_revision->type, '%title' => $node_revision->title[LANGUAGE_NONE][0]['value'], '%revision' => $node_revision->vid));
+ drupal_set_message(t('Revision from %revision-date of @type %title has been deleted.', array('%revision-date' => format_date($node_revision->revision_timestamp), '@type' => node_type_get_name($node_revision), '%title' => $node_revision->title[LANGUAGE_NONE][0]['value'])));
$form_state['redirect'] = 'node/' . $node_revision->nid;
if (db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid', array(':nid' => $node_revision->nid))->fetchField() > 1) {
$form_state['redirect'] .= '/revisions';
diff --git a/modules/node/node.test b/modules/node/node.test
index fc633d2db..8d27c11bb 100644
--- a/modules/node/node.test
+++ b/modules/node/node.test
@@ -31,15 +31,15 @@ class NodeLoadMultipleUnitTest extends DrupalWebTestCase {
// Confirm that promoted nodes appear in the default node listing.
$this->drupalGet('node');
- $this->assertText($node1->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node title appears on the default listing.'));
- $this->assertText($node2->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node title appears on the default listing.'));
- $this->assertNoText($node3->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node title does not appear in the default listing.'));
- $this->assertNoText($node4->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node title does not appear in the default listing.'));
+ $this->assertText($node1->title[LANGUAGE_NONE][0]['value'], t('Node title appears on the default listing.'));
+ $this->assertText($node2->title[LANGUAGE_NONE][0]['value'], t('Node title appears on the default listing.'));
+ $this->assertNoText($node3->title[LANGUAGE_NONE][0]['value'], t('Node title does not appear in the default listing.'));
+ $this->assertNoText($node4->title[LANGUAGE_NONE][0]['value'], t('Node title does not appear in the default listing.'));
// Load nodes with only a condition. Nodes 3 and 4 will be loaded.
$nodes = node_load_multiple(NULL, array('promote' => 0));
- $this->assertEqual($node3->title[FIELD_LANGUAGE_NONE][0]['value'], $nodes[$node3->nid]->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node was loaded.'));
- $this->assertEqual($node4->title[FIELD_LANGUAGE_NONE][0]['value'], $nodes[$node4->nid]->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node was loaded.'));
+ $this->assertEqual($node3->title[LANGUAGE_NONE][0]['value'], $nodes[$node3->nid]->title[LANGUAGE_NONE][0]['value'], t('Node was loaded.'));
+ $this->assertEqual($node4->title[LANGUAGE_NONE][0]['value'], $nodes[$node4->nid]->title[LANGUAGE_NONE][0]['value'], t('Node was loaded.'));
$count = count($nodes);
$this->assertTrue($count == 2, t('@count nodes loaded.', array('@count' => $count)));
@@ -58,9 +58,9 @@ class NodeLoadMultipleUnitTest extends DrupalWebTestCase {
$nodes = node_load_multiple(array(1, 2, 3, 4), array('type' => 'article'));
$count = count($nodes);
$this->assertTrue($count == 3, t('@count nodes loaded', array('@count' => $count)));
- $this->assertEqual($nodes[$node1->nid]->title[FIELD_LANGUAGE_NONE][0]['value'], $node1->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node successfully loaded.'));
- $this->assertEqual($nodes[$node2->nid]->title[FIELD_LANGUAGE_NONE][0]['value'], $node2->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node successfully loaded.'));
- $this->assertEqual($nodes[$node3->nid]->title[FIELD_LANGUAGE_NONE][0]['value'], $node3->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node successfully loaded.'));
+ $this->assertEqual($nodes[$node1->nid]->title[LANGUAGE_NONE][0]['value'], $node1->title[LANGUAGE_NONE][0]['value'], t('Node successfully loaded.'));
+ $this->assertEqual($nodes[$node2->nid]->title[LANGUAGE_NONE][0]['value'], $node2->title[LANGUAGE_NONE][0]['value'], t('Node successfully loaded.'));
+ $this->assertEqual($nodes[$node3->nid]->title[LANGUAGE_NONE][0]['value'], $node3->title[LANGUAGE_NONE][0]['value'], t('Node successfully loaded.'));
$this->assertFalse(isset($nodes[$node4->nid]));
// Now that all nodes have been loaded into the static cache, ensure that
@@ -68,16 +68,16 @@ class NodeLoadMultipleUnitTest extends DrupalWebTestCase {
$nodes = node_load_multiple(array(1, 2, 3, 4), array('type' => 'article'));
$count = count($nodes);
$this->assertTrue($count == 3, t('@count nodes loaded.', array('@count' => $count)));
- $this->assertEqual($nodes[$node1->nid]->title[FIELD_LANGUAGE_NONE][0]['value'], $node1->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node successfully loaded'));
- $this->assertEqual($nodes[$node2->nid]->title[FIELD_LANGUAGE_NONE][0]['value'], $node2->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node successfully loaded'));
- $this->assertEqual($nodes[$node3->nid]->title[FIELD_LANGUAGE_NONE][0]['value'], $node3->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node successfully loaded'));
+ $this->assertEqual($nodes[$node1->nid]->title[LANGUAGE_NONE][0]['value'], $node1->title[LANGUAGE_NONE][0]['value'], t('Node successfully loaded'));
+ $this->assertEqual($nodes[$node2->nid]->title[LANGUAGE_NONE][0]['value'], $node2->title[LANGUAGE_NONE][0]['value'], t('Node successfully loaded'));
+ $this->assertEqual($nodes[$node3->nid]->title[LANGUAGE_NONE][0]['value'], $node3->title[LANGUAGE_NONE][0]['value'], t('Node successfully loaded'));
$this->assertFalse(isset($nodes[$node4->nid]), t('Node was not loaded'));
// Load nodes by nid, where type = article and promote = 0.
$nodes = node_load_multiple(array(1, 2, 3, 4), array('type' => 'article', 'promote' => 0));
$count = count($nodes);
$this->assertTrue($count == 1, t('@count node loaded', array('@count' => $count)));
- $this->assertEqual($nodes[$node3->nid]->title[FIELD_LANGUAGE_NONE][0]['value'], $node3->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node successfully loaded.'));
+ $this->assertEqual($nodes[$node3->nid]->title[LANGUAGE_NONE][0]['value'], $node3->title[LANGUAGE_NONE][0]['value'], t('Node successfully loaded.'));
}
}
@@ -141,7 +141,7 @@ class NodeRevisionsTestCase extends DrupalWebTestCase {
// Confirm the correct revision text appears on "view revisions" page.
$this->drupalGet("node/$node->nid/revisions/$node->vid/view");
- $this->assertText($node->body[FIELD_LANGUAGE_NONE][0]['value'], t('Correct text displays for version.'));
+ $this->assertText($node->body[LANGUAGE_NONE][0]['value'], t('Correct text displays for version.'));
// Confirm the correct log message appears on "revisions overview" page.
$this->drupalGet("node/$node->nid/revisions");
@@ -152,16 +152,16 @@ class NodeRevisionsTestCase extends DrupalWebTestCase {
// Confirm that revisions revert properly.
$this->drupalPost("node/$node->nid/revisions/{$nodes[1]->vid}/revert", array(), t('Revert'));
$this->assertRaw(t('@type %title has been reverted back to the revision from %revision-date.',
- array('@type' => 'Page', '%title' => $nodes[1]->title[FIELD_LANGUAGE_NONE][0]['value'],
+ array('@type' => 'Page', '%title' => $nodes[1]->title[LANGUAGE_NONE][0]['value'],
'%revision-date' => format_date($nodes[1]->revision_timestamp))), t('Revision reverted.'));
$reverted_node = node_load($node->nid);
- $this->assertTrue(($nodes[1]->body[FIELD_LANGUAGE_NONE][0]['value'] == $reverted_node->body[FIELD_LANGUAGE_NONE][0]['value']), t('Node reverted correctly.'));
+ $this->assertTrue(($nodes[1]->body[LANGUAGE_NONE][0]['value'] == $reverted_node->body[LANGUAGE_NONE][0]['value']), t('Node reverted correctly.'));
// Confirm revisions delete properly.
$this->drupalPost("node/$node->nid/revisions/{$nodes[1]->vid}/delete", array(), t('Delete'));
$this->assertRaw(t('Revision from %revision-date of @type %title has been deleted.',
array('%revision-date' => format_date($nodes[1]->revision_timestamp),
- '@type' => 'Page', '%title' => $nodes[1]->title[FIELD_LANGUAGE_NONE][0]['value'])), t('Revision deleted.'));
+ '@type' => 'Page', '%title' => $nodes[1]->title[LANGUAGE_NONE][0]['value'])), t('Revision deleted.'));
$this->assertTrue(db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid and vid = :vid', array(':nid' => $node->nid, ':vid' => $nodes[1]->vid))->fetchField() == 0, t('Revision not found.'));
}
}
@@ -186,7 +186,7 @@ class PageEditTestCase extends DrupalWebTestCase {
* Check node edit functionality.
*/
function testPageEdit() {
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$title_key = "title[$langcode][0][value]";
$body_key = "body[$langcode][0][value]";
// Create node to edit.
@@ -268,7 +268,7 @@ class PagePreviewTestCase extends DrupalWebTestCase {
* Check the node preview functionality.
*/
function testPagePreview() {
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$title_key = "title[$langcode][0][value]";
$body_key = "body[$langcode][0][value]";
@@ -292,7 +292,7 @@ class PagePreviewTestCase extends DrupalWebTestCase {
* Check the node preview functionality, when using revisions.
*/
function testPagePreviewWithRevisions() {
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$title_key = "title[$langcode][0][value]";
$body_key = "body[$langcode][0][value]";
// Force revision on page content.
@@ -342,7 +342,7 @@ class PageCreationTestCase extends DrupalWebTestCase {
function testPageCreation() {
// Create a node.
$edit = array();
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$edit["title[$langcode][0][value]"] = $this->randomName(8);
$edit["body[$langcode][0][value]"] = $this->randomName(16);
$this->drupalPost('node/add/page', $edit, t('Save'));
@@ -361,7 +361,7 @@ class PageCreationTestCase extends DrupalWebTestCase {
function testFailedPageCreation() {
// Create a node.
$edit = array();
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$edit["title[$langcode][0][value]"] = 'testing_transaction_exception';
$edit["body[$langcode][0][value]"] = $this->randomName(16);
$this->drupalPost('node/add/page', $edit, t('Save'));
@@ -441,7 +441,7 @@ class SummaryLengthTestCase extends DrupalWebTestCase {
function testSummaryLength() {
// Create a node to view.
$settings = array(
- 'body' => array(FIELD_LANGUAGE_NONE => array(array('value' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam vitae arcu at leo cursus laoreet. Curabitur dui tortor, adipiscing malesuada tempor in, bibendum ac diam. Cras non tellus a libero pellentesque condimentum. What is a Drupalism? Suspendisse ac lacus libero. Ut non est vel nisl faucibus interdum nec sed leo. Pellentesque sem risus, vulputate eu semper eget, auctor in libero. Ut fermentum est vitae metus convallis scelerisque. Phasellus pellentesque rhoncus tellus, eu dignissim purus posuere id. Quisque eu fringilla ligula. Morbi ullamcorper, lorem et mattis egestas, tortor neque pretium velit, eget eleifend odio turpis eu purus. Donec vitae metus quis leo pretium tincidunt a pulvinar sem. Morbi adipiscing laoreet mauris vel placerat. Nullam elementum, nisl sit amet scelerisque malesuada, dolor nunc hendrerit quam, eu ultrices erat est in orci. Curabitur feugiat egestas nisl sed accumsan.'))),
+ 'body' => array(LANGUAGE_NONE => array(array('value' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam vitae arcu at leo cursus laoreet. Curabitur dui tortor, adipiscing malesuada tempor in, bibendum ac diam. Cras non tellus a libero pellentesque condimentum. What is a Drupalism? Suspendisse ac lacus libero. Ut non est vel nisl faucibus interdum nec sed leo. Pellentesque sem risus, vulputate eu semper eget, auctor in libero. Ut fermentum est vitae metus convallis scelerisque. Phasellus pellentesque rhoncus tellus, eu dignissim purus posuere id. Quisque eu fringilla ligula. Morbi ullamcorper, lorem et mattis egestas, tortor neque pretium velit, eget eleifend odio turpis eu purus. Donec vitae metus quis leo pretium tincidunt a pulvinar sem. Morbi adipiscing laoreet mauris vel placerat. Nullam elementum, nisl sit amet scelerisque malesuada, dolor nunc hendrerit quam, eu ultrices erat est in orci. Curabitur feugiat egestas nisl sed accumsan.'))),
'promote' => 1,
);
$node = $this->drupalCreateNode($settings);
@@ -484,7 +484,7 @@ class NodeTitleXSSTestCase extends DrupalWebTestCase {
$xss = '<script>alert("xss")</script>';
$title = $xss . $this->randomName();
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$edit = array(
"title[$langcode][0][value]" => $title,
);
@@ -492,7 +492,7 @@ class NodeTitleXSSTestCase extends DrupalWebTestCase {
$this->drupalPost('node/add/page', $edit, t('Preview'));
$this->assertNoRaw($xss, t('Harmful tags are escaped when previewing a node.'));
- $settings = array('title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $title))));
+ $settings = array('title' => array(LANGUAGE_NONE => array(array('value' => $title))));
$node = $this->drupalCreateNode($settings);
$this->drupalGet('node/' . $node->nid);
@@ -566,7 +566,7 @@ class NodePostSettingsTestCase extends DrupalWebTestCase {
// Create a node.
$edit = array();
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$edit["title[$langcode][0][value]"] = $this->randomName(8);
$edit["body[$langcode][0][value]"] = $this->randomName(16);
$this->drupalPost('node/add/page', $edit, t('Save'));
@@ -588,7 +588,7 @@ class NodePostSettingsTestCase extends DrupalWebTestCase {
// Create a node.
$edit = array();
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$edit["title[$langcode][0][value]"] = $this->randomName(8);
$edit["body[$langcode][0][value]"] = $this->randomName(16);
$this->drupalPost('node/add/page', $edit, t('Save'));
@@ -833,8 +833,8 @@ class NodeSaveTestCase extends DrupalWebTestCase {
$test_nid = $max_nid + mt_rand(1000, 1000000);
$title = $this->randomName(8);
$node = array(
- 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $title))),
- 'body' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(32)))),
+ 'title' => array(LANGUAGE_NONE => array(array('value' => $title))),
+ 'body' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(32)))),
'uid' => $this->web_user->uid,
'type' => 'article',
'nid' => $test_nid,
@@ -1123,23 +1123,23 @@ class NodeTitleTestCase extends DrupalWebTestCase {
function testNodeTitle() {
// Create page content with title
$settings = array(
- 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
+ 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
);
$node = $this->drupalCreateNode($settings);
// Test <title> tag.
$this->drupalGet("node/$node->nid");
$xpath = '//title';
- $this->assertEqual(current($this->xpath($xpath)), $node->title[FIELD_LANGUAGE_NONE][0]['value'] .' | Drupal', 'Page title is equal to node title.', 'Node');
+ $this->assertEqual(current($this->xpath($xpath)), $node->title[LANGUAGE_NONE][0]['value'] .' | Drupal', 'Page title is equal to node title.', 'Node');
// Test breadcrumb in comment preview.
$this->drupalGet("comment/reply/$node->nid");
$xpath = '//div[@class="breadcrumb"]/a[last()]';
- $this->assertEqual(current($this->xpath($xpath)), $node->title[FIELD_LANGUAGE_NONE][0]['value'], 'Node breadcrumb is equal to node title.', 'Node');
+ $this->assertEqual(current($this->xpath($xpath)), $node->title[LANGUAGE_NONE][0]['value'], 'Node breadcrumb is equal to node title.', 'Node');
// Test node title in comment preview.
$xpath = '//div[@id="node-'. $node->nid .'"]/h2/a';
- $this->assertEqual(current($this->xpath($xpath)), $node->title[FIELD_LANGUAGE_NONE][0]['value'], 'Node preview title is equal to node title.', 'Node');
+ $this->assertEqual(current($this->xpath($xpath)), $node->title[LANGUAGE_NONE][0]['value'], 'Node preview title is equal to node title.', 'Node');
}
}
diff --git a/modules/node/node.tokens.inc b/modules/node/node.tokens.inc
index 40709a2af..e0745867c 100644
--- a/modules/node/node.tokens.inc
+++ b/modules/node/node.tokens.inc
@@ -134,18 +134,18 @@ function node_tokens($type, $tokens, array $data = array(), array $options = arr
break;
case 'title':
- $replacements[$original] = $sanitize ? check_plain($node->title[FIELD_LANGUAGE_NONE][0]['value']) : $node->title[FIELD_LANGUAGE_NONE][0]['value'];
+ $replacements[$original] = $sanitize ? check_plain($node->title[LANGUAGE_NONE][0]['value']) : $node->title[LANGUAGE_NONE][0]['value'];
break;
case 'body':
if (!empty($node->body)) {
- $replacements[$original] = $sanitize ? $node->body[FIELD_LANGUAGE_NONE][0]['safe'] : $node->body[FIELD_LANGUAGE_NONE][0]['value'];
+ $replacements[$original] = $sanitize ? $node->body[LANGUAGE_NONE][0]['safe'] : $node->body[LANGUAGE_NONE][0]['value'];
}
break;
case 'summary':
if (!empty($node->body)) {
- $replacements[$original] = $sanitize ? $node->body[FIELD_LANGUAGE_NONE][0]['safe_summary'] : $node->body[FIELD_LANGUAGE_NONE][0]['summary'];
+ $replacements[$original] = $sanitize ? $node->body[LANGUAGE_NONE][0]['safe_summary'] : $node->body[LANGUAGE_NONE][0]['summary'];
}
break;
diff --git a/modules/path/path.admin.inc b/modules/path/path.admin.inc
index 74dde0c8b..94fbf5d4c 100644
--- a/modules/path/path.admin.inc
+++ b/modules/path/path.admin.inc
@@ -16,7 +16,7 @@ function path_admin_overview($keys = NULL) {
// Add the filter form above the overview table.
$build['path_admin_filter_form'] = drupal_get_form('path_admin_filter_form', $keys);
// Enable language column if locale is enabled or if we have any alias with language
- $alias_exists = (bool) db_query_range('SELECT 1 FROM {url_alias} WHERE language <> :language', 0, 1, array(':language' => ''))->fetchField();
+ $alias_exists = (bool) db_query_range('SELECT 1 FROM {url_alias} WHERE language <> :language', 0, 1, array(':language' => LANGUAGE_NONE))->fetchField();
$multilanguage = (module_exists('locale') || $alias_exists);
$header = array(
@@ -94,7 +94,7 @@ function path_admin_edit($path = array()) {
* @see path_admin_form_validate()
* @see path_admin_form_submit()
*/
-function path_admin_form($form, &$form_state, $path = array('source' => '', 'alias' => '', 'language' => '', 'pid' => NULL)) {
+function path_admin_form($form, &$form_state, $path = array('source' => '', 'alias' => '', 'language' => LANGUAGE_NONE, 'pid' => NULL)) {
$form['source'] = array(
'#type' => 'textfield',
'#title' => t('Existing system path'),
@@ -151,7 +151,7 @@ function path_admin_form_validate($form, &$form_state) {
$alias = $form_state['values']['alias'];
$pid = isset($form_state['values']['pid']) ? $form_state['values']['pid'] : 0;
// Language is only set if locale module is enabled, otherwise save for all languages.
- $language = isset($form_state['values']['language']) ? $form_state['values']['language'] : '';
+ $language = isset($form_state['values']['language']) ? $form_state['values']['language'] : LANGUAGE_NONE;
$has_alias = db_query("SELECT COUNT(alias) FROM {url_alias} WHERE pid <> :pid AND alias = :alias AND language = :language", array(
':pid' => $pid,
diff --git a/modules/path/path.module b/modules/path/path.module
index c27716186..031526564 100644
--- a/modules/path/path.module
+++ b/modules/path/path.module
@@ -100,7 +100,7 @@ function path_form_alter(&$form, $form_state, $form_id) {
$path = array();
if (!empty($form['#node']->nid)) {
$conditions = array('source' => 'node/' . $form['#node']->nid);
- if (!empty($form['#node']->language)) {
+ if ($form['#node']->language != LANGUAGE_NONE) {
$conditions['language'] = $form['#node']->language;
}
$path = path_load($conditions);
@@ -112,7 +112,7 @@ function path_form_alter(&$form, $form_state, $form_id) {
'pid' => NULL,
'source' => isset($form['#node']->nid) ? 'node/' . $form['#node']->nid : NULL,
'alias' => '',
- 'language' => isset($form['#node']->language) ? $form['#node']->language : '',
+ 'language' => isset($form['#node']->language) ? $form['#node']->language : LANGUAGE_NONE,
);
$form['path'] = array(
@@ -190,7 +190,7 @@ function path_node_insert($node) {
if (!empty($path['alias'])) {
// Ensure fields for programmatic executions.
$path['source'] = 'node/' . $node->nid;
- $path['language'] = isset($node->language) ? $node->language : '';
+ $path['language'] = isset($node->language) ? $node->language : LANGUAGE_NONE;
path_save($path);
}
}
@@ -211,7 +211,7 @@ function path_node_update($node) {
if (!empty($path['alias'])) {
// Ensure fields for programmatic executions.
$path['source'] = 'node/' . $node->nid;
- $path['language'] = isset($node->language) ? $node->language : '';
+ $path['language'] = isset($node->language) ? $node->language : LANGUAGE_NONE;
path_save($path);
}
}
@@ -239,7 +239,7 @@ function path_form_taxonomy_form_term_alter(&$form, $form_state) {
'pid' => NULL,
'source' => isset($form['#term']['tid']) ? 'taxonomy/term/' . $form['#term']['tid'] : NULL,
'alias' => '',
- 'language' => '',
+ 'language' => LANGUAGE_NONE,
);
$form['identification']['path'] = array(
'#access' => user_access('create url aliases') || user_access('administer url aliases'),
@@ -271,7 +271,7 @@ function path_taxonomy_term_insert($term) {
if (!empty($path['alias'])) {
// Ensure fields for programmatic executions.
$path['source'] = 'taxonomy/term/' . $term->tid;
- $path['language'] = '';
+ $path['language'] = LANGUAGE_NONE;
path_save($path);
}
}
@@ -292,7 +292,7 @@ function path_taxonomy_term_update($term) {
if (!empty($path['alias'])) {
// Ensure fields for programmatic executions.
$path['source'] = 'taxonomy/term/' . $term->tid;
- $path['language'] = '';
+ $path['language'] = LANGUAGE_NONE;
path_save($path);
}
}
diff --git a/modules/path/path.test b/modules/path/path.test
index 9ad9d6098..43a9d778a 100644
--- a/modules/path/path.test
+++ b/modules/path/path.test
@@ -63,7 +63,7 @@ class PathTestCase extends DrupalWebTestCase {
// Confirm that the alias works.
$this->drupalGet($edit['alias']);
- $this->assertText($node1->title[FIELD_LANGUAGE_NONE][0]['value'], 'Alias works.');
+ $this->assertText($node1->title[LANGUAGE_NONE][0]['value'], 'Alias works.');
// Change alias.
$pid = $this->getPID($edit['alias']);
@@ -74,7 +74,7 @@ class PathTestCase extends DrupalWebTestCase {
// Confirm that the alias works.
$this->drupalGet($edit['alias']);
- $this->assertText($node1->title[FIELD_LANGUAGE_NONE][0]['value'], 'Changed alias works.');
+ $this->assertText($node1->title[LANGUAGE_NONE][0]['value'], 'Changed alias works.');
drupal_static_reset('drupal_lookup_path');
// Confirm that previous alias no longer works.
@@ -115,7 +115,7 @@ class PathTestCase extends DrupalWebTestCase {
// Confirm that the alias works.
$this->drupalGet($edit['path[alias]']);
- $this->assertText($node1->title[FIELD_LANGUAGE_NONE][0]['value'], 'Alias works.');
+ $this->assertText($node1->title[LANGUAGE_NONE][0]['value'], 'Alias works.');
// Change alias.
$previous = $edit['path[alias]'];
@@ -124,11 +124,11 @@ class PathTestCase extends DrupalWebTestCase {
// Confirm that the alias works.
$this->drupalGet($edit['path[alias]']);
- $this->assertText($node1->title[FIELD_LANGUAGE_NONE][0]['value'], 'Changed alias works.');
+ $this->assertText($node1->title[LANGUAGE_NONE][0]['value'], 'Changed alias works.');
// Make sure that previous alias no longer works.
$this->drupalGet($previous);
- $this->assertNoText($node1->title[FIELD_LANGUAGE_NONE][0]['value'], 'Previous alias no longer works.');
+ $this->assertNoText($node1->title[LANGUAGE_NONE][0]['value'], 'Previous alias no longer works.');
$this->assertResponse(404);
// Create second test node.
@@ -264,7 +264,7 @@ class PathLanguageTestCase extends DrupalWebTestCase {
// Confirm that the alias works.
$this->drupalGet($edit['path[alias]']);
- $this->assertText($english_node->title[FIELD_LANGUAGE_NONE][0]['value'], 'Alias works.');
+ $this->assertText($english_node->title[LANGUAGE_NONE][0]['value'], 'Alias works.');
// Translate the node into French.
$this->drupalGet('node/' . $english_node->nid . '/translate');
@@ -272,7 +272,7 @@ class PathLanguageTestCase extends DrupalWebTestCase {
$edit = array();
$langcode = 'fr';
$edit["body[$langcode][0][value]"] = $this->randomName();
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$edit["title[$langcode][0][value]"] = $this->randomName();
$edit['path[alias]'] = $this->randomName();
$this->drupalPost(NULL, $edit, t('Save'));
@@ -286,7 +286,7 @@ class PathLanguageTestCase extends DrupalWebTestCase {
// Confirm that the alias works.
$this->drupalGet('fr/' . $edit['path[alias]']);
- $this->assertText($french_node->title[FIELD_LANGUAGE_NONE][0]['value'], 'Alias for French translation works.');
+ $this->assertText($french_node->title[LANGUAGE_NONE][0]['value'], 'Alias for French translation works.');
// Confirm that the alias is returned by url().
drupal_static_reset('language_list');
diff --git a/modules/php/php.test b/modules/php/php.test
index 142f7a858..a70fb0ac6 100644
--- a/modules/php/php.test
+++ b/modules/php/php.test
@@ -30,7 +30,7 @@ class PHPTestCase extends DrupalWebTestCase {
* @return stdObject Node object.
*/
function createNodeWithCode() {
- return $this->drupalCreateNode(array('body' => array(FIELD_LANGUAGE_NONE => array(array('value' => '<?php print "SimpleTest PHP was executed!"; ?>')))));
+ return $this->drupalCreateNode(array('body' => array(LANGUAGE_NONE => array(array('value' => '<?php print "SimpleTest PHP was executed!"; ?>')))));
}
}
@@ -64,10 +64,10 @@ class PHPFilterTestCase extends PHPTestCase {
// Change filter to PHP filter and see that PHP code is evaluated.
$edit = array();
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$edit["body[$langcode][0][value_format]"] = $this->php_code_format;
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
- $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), t('PHP code filter turned on.'));
+ $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title[LANGUAGE_NONE][0]['value'])), t('PHP code filter turned on.'));
// Make sure that the PHP code shows up as text.
$this->assertNoText('print', t('PHP code isn\'t displayed.'));
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index 1c206a994..4fc1a3668 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -713,7 +713,7 @@ function poll_vote($form, &$form_state) {
function template_preprocess_poll_vote(&$variables) {
$form = $variables['form'];
$variables['choice'] = drupal_render($form['choice']);
- $variables['title'] = check_plain($form['#node']->title[FIELD_LANGUAGE_NONE][0]['value']);
+ $variables['title'] = check_plain($form['#node']->title[LANGUAGE_NONE][0]['value']);
$variables['vote'] = drupal_render($form['vote']);
$variables['rest'] = drupal_render_children($form);
$variables['block'] = $form['#block'];
@@ -745,7 +745,7 @@ function poll_view_results($node, $build_mode, $block = FALSE) {
}
}
- return theme('poll_results', array('raw_title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'], 'results' => $poll_results, 'votes' => $total_votes, 'raw_links' => isset($node->links) ? $node->links : array(), 'block' => $block, 'nid' => $node->nid, 'vote' => isset($node->vote) ? $node->vote : NULL));
+ return theme('poll_results', array('raw_title' => $node->title[LANGUAGE_NONE][0]['value'], 'results' => $poll_results, 'votes' => $total_votes, 'raw_links' => isset($node->links) ? $node->links : array(), 'block' => $block, 'nid' => $node->nid, 'vote' => isset($node->vote) ? $node->vote : NULL));
}
diff --git a/modules/poll/poll.pages.inc b/modules/poll/poll.pages.inc
index 0661944db..9cddde586 100644
--- a/modules/poll/poll.pages.inc
+++ b/modules/poll/poll.pages.inc
@@ -51,7 +51,7 @@ function poll_page() {
*/
function poll_votes($node) {
$votes_per_page = 20;
- drupal_set_title($node->title[FIELD_LANGUAGE_NONE][0]['value']);
+ drupal_set_title($node->title[LANGUAGE_NONE][0]['value']);
$header[] = array('data' => t('Visitor'), 'field' => 'u.name');
$header[] = array('data' => t('Vote'), 'field' => 'pc.chtext');
@@ -92,7 +92,7 @@ function poll_votes($node) {
* Callback for the 'results' tab for polls you can vote on
*/
function poll_results($node) {
- drupal_set_title($node->title[FIELD_LANGUAGE_NONE][0]['value']);
+ drupal_set_title($node->title[LANGUAGE_NONE][0]['value']);
$node->show_results = TRUE;
return node_show($node);
}
diff --git a/modules/poll/poll.test b/modules/poll/poll.test
index 3aa108901..f96ff6595 100644
--- a/modules/poll/poll.test
+++ b/modules/poll/poll.test
@@ -57,7 +57,7 @@ class PollTestCase extends DrupalWebTestCase {
$already_submitted_choices = array_slice($choices, 0, $index);
$new_choices = array_values(array_slice($choices, $index, $max_new_choices));
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$edit = array(
"title[$langcode][0][value]" => $title
);
@@ -332,7 +332,7 @@ class PollJSAddChoice extends DrupalWebTestCase {
$web_user = $this->drupalCreateUser(array('create poll content', 'access content'));
$this->drupalLogin($web_user);
$this->drupalGet('node/add/poll');
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$edit = array(
"title[$langcode][0][value]" => $this->randomName(),
'choice[new:0][chtext]' => $this->randomName(),
diff --git a/modules/search/search.api.php b/modules/search/search.api.php
index a3170087c..2a4919105 100644
--- a/modules/search/search.api.php
+++ b/modules/search/search.api.php
@@ -191,7 +191,7 @@ function hook_search_execute($keys = NULL) {
$results[] = array(
'link' => url('node/' . $item->sid, array('absolute' => TRUE)),
'type' => check_plain(node_type_get_name($node)),
- 'title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'],
+ 'title' => $node->title[LANGUAGE_NONE][0]['value'],
'user' => theme('username', array('account' => $node)),
'date' => $node->changed,
'node' => $node,
@@ -267,7 +267,7 @@ function hook_update_index() {
node_build_content($node, 'search_index');
$node->rendered = drupal_render($node->content);
- $text = '<h1>' . check_plain($node->title[FIELD_LANGUAGE_NONE][0]['value']) . '</h1>' . $node->rendered;
+ $text = '<h1>' . check_plain($node->title[LANGUAGE_NONE][0]['value']) . '</h1>' . $node->rendered;
// Fetch extra data normally not visible
$extra = module_invoke_all('node_update_index', $node);
diff --git a/modules/search/search.test b/modules/search/search.test
index 9145d3385..15cc1328d 100644
--- a/modules/search/search.test
+++ b/modules/search/search.test
@@ -280,17 +280,17 @@ class SearchAdvancedSearchForm extends DrupalWebTestCase {
$this->assertNoText($this->node->title, t('Page node is not found with dummy title.'));
// Search for the title of the node with a GET query.
- $this->drupalGet('search/node/' . $this->node->title[FIELD_LANGUAGE_NONE][0]['value']);
- $this->assertText($this->node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Page node is found with GET query.'));
+ $this->drupalGet('search/node/' . $this->node->title[LANGUAGE_NONE][0]['value']);
+ $this->assertText($this->node->title[LANGUAGE_NONE][0]['value'], t('Page node is found with GET query.'));
// Search for the title of the node with a POST query.
- $edit = array('or' => $this->node->title[FIELD_LANGUAGE_NONE][0]['value']);
+ $edit = array('or' => $this->node->title[LANGUAGE_NONE][0]['value']);
$this->drupalPost('search/node', $edit, t('Advanced search'));
- $this->assertText($this->node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Page node is found with POST query.'));
+ $this->assertText($this->node->title[LANGUAGE_NONE][0]['value'], t('Page node is found with POST query.'));
// Advanced search type option.
$this->drupalPost('search/node', array_merge($edit, array('type[page]' => 'page')), t('Advanced search'));
- $this->assertText($this->node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Page node is found with POST query and type:page.'));
+ $this->assertText($this->node->title[LANGUAGE_NONE][0]['value'], t('Page node is found with POST query and type:page.'));
$this->drupalPost('search/node', array_merge($edit, array('type[article]' => 'article')), t('Advanced search'));
$this->assertText('bike shed', t('Article node is not found with POST query and type:article.'));
@@ -322,7 +322,7 @@ class SearchRankingTestCase extends DrupalWebTestCase {
// Create nodes for testing.
foreach ($node_ranks as $node_rank) {
- $settings = array('type' => 'page', 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => 'Drupal rocks'))), 'body' => array(FIELD_LANGUAGE_NONE => array(array('value' => "Drupal's search rocks"))));
+ $settings = array('type' => 'page', 'title' => array(LANGUAGE_NONE => array(array('value' => 'Drupal rocks'))), 'body' => array(LANGUAGE_NONE => array(array('value' => "Drupal's search rocks"))));
foreach (array(0, 1) as $num) {
if ($num == 1) {
switch ($node_rank) {
@@ -331,7 +331,7 @@ class SearchRankingTestCase extends DrupalWebTestCase {
$settings[$node_rank] = 1;
break;
case 'relevance':
- $settings['body'][FIELD_LANGUAGE_NONE][0]['value'] .= " really rocks";
+ $settings['body'][LANGUAGE_NONE][0]['value'] .= " really rocks";
break;
case 'recent':
$settings['created'] = REQUEST_TIME + 3600;
@@ -501,7 +501,7 @@ class SearchCommentTestCase extends DrupalWebTestCase {
'search_block_form' => $comment_body,
);
$this->drupalPost('', $edit, t('Search'));
- $this->assertText($node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node found in search results.'));
+ $this->assertText($node->title[LANGUAGE_NONE][0]['value'], t('Node found in search results.'));
// Verify that comment is rendered using proper format.
$this->assertText($edit_comment['subject'], t('Comment subject found in search results.'));
diff --git a/modules/simpletest/drupal_web_test_case.php b/modules/simpletest/drupal_web_test_case.php
index d70304d7f..55f559f39 100644
--- a/modules/simpletest/drupal_web_test_case.php
+++ b/modules/simpletest/drupal_web_test_case.php
@@ -696,8 +696,8 @@ class DrupalWebTestCase extends DrupalTestCase {
protected function drupalCreateNode($settings = array()) {
// Populate defaults array.
$settings += array(
- 'body' => array(FIELD_LANGUAGE_NONE => array(array())),
- 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
+ 'body' => array(LANGUAGE_NONE => array(array())),
+ 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
'comment' => 2,
'changed' => REQUEST_TIME,
'moderate' => 0,
@@ -709,6 +709,7 @@ class DrupalWebTestCase extends DrupalTestCase {
'type' => 'page',
'revisions' => NULL,
'taxonomy' => NULL,
+ 'language' => LANGUAGE_NONE,
);
// Use the original node's created time for existing nodes.
@@ -733,8 +734,7 @@ class DrupalWebTestCase extends DrupalTestCase {
'value' => $this->randomName(32),
'format' => filter_default_format(),
);
- $langcode = !empty($settings['language']) ? $settings['language'] : FIELD_LANGUAGE_NONE;
- $settings['body'][$langcode][0] += $body;
+ $settings['body'][$settings['language']][0] += $body;
$node = (object) $settings;
node_save($node);
diff --git a/modules/simpletest/tests/common.test b/modules/simpletest/tests/common.test
index 76c4d4dfc..274dceb45 100644
--- a/modules/simpletest/tests/common.test
+++ b/modules/simpletest/tests/common.test
@@ -593,7 +593,7 @@ class CascadingStylesheetsTestCase extends DrupalWebTestCase {
$settings = array(
'type' => 'page',
'body' => array(
- FIELD_LANGUAGE_NONE => array(
+ LANGUAGE_NONE => array(
array(
'value' => t('This tests the inline CSS!') . "<?php drupal_add_css('$css', 'inline'); ?>",
// The "PHP code" format is always the most recent one added, since
diff --git a/modules/statistics/statistics.pages.inc b/modules/statistics/statistics.pages.inc
index 5dc6f8962..01d902932 100644
--- a/modules/statistics/statistics.pages.inc
+++ b/modules/statistics/statistics.pages.inc
@@ -38,7 +38,7 @@ function statistics_node_tracker() {
);
}
- drupal_set_title($node->title[FIELD_LANGUAGE_NONE][0]['value']);
+ drupal_set_title($node->title[LANGUAGE_NONE][0]['value']);
$build['statistics_table'] = array(
'#theme' => 'table',
'#header' => $header,
diff --git a/modules/system/system.api.php b/modules/system/system.api.php
index 202c08732..3e0938fba 100644
--- a/modules/system/system.api.php
+++ b/modules/system/system.api.php
@@ -1264,7 +1264,7 @@ function hook_mail($key, &$message, $params) {
'%uid' => $node->uid,
'%node_url' => url('node/' . $node->nid, array('absolute' => TRUE)),
'%node_type' => node_type_get_name($node),
- '%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'],
+ '%title' => $node->title[LANGUAGE_NONE][0]['value'],
'%teaser' => $node->teaser,
'%body' => $node->body,
);
diff --git a/modules/system/system.install b/modules/system/system.install
index 2b9af7a18..8bd1dcce8 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -2813,6 +2813,16 @@ function system_update_7047() {
}
/**
+ * Convert path languages from the empty string to LANGUAGE_NONE.
+ */
+function system_update_7048() {
+ db_update('url_alias')
+ ->fields(array('language' => LANGUAGE_NONE))
+ ->condition('language', '')
+ ->execute();
+}
+
+/**
* @} End of "defgroup updates-6.x-to-7.x"
* The next series of updates should start at 8000.
*/
diff --git a/modules/system/system.test b/modules/system/system.test
index ff43b97ec..9ecebd9ec 100644
--- a/modules/system/system.test
+++ b/modules/system/system.test
@@ -530,8 +530,8 @@ class AccessDeniedTestCase extends DrupalWebTestCase {
$this->assertText(t('Access denied'), t('Found the default 403 page'));
$edit = array(
- 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(10)))),
- 'body' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(100)))),
+ 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(10)))),
+ 'body' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(100)))),
);
$node = $this->drupalCreateNode($edit);
@@ -539,13 +539,13 @@ class AccessDeniedTestCase extends DrupalWebTestCase {
$this->drupalPost('admin/config/system/site-information', array('site_403' => 'node/' . $node->nid), t('Save configuration'));
$this->drupalGet('admin');
- $this->assertText($node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Found the custom 403 page'));
+ $this->assertText($node->title[LANGUAGE_NONE][0]['value'], t('Found the custom 403 page'));
// Logout and check that the user login block is shown on custom 403 pages.
$this->drupalLogout();
$this->drupalGet('admin');
- $this->assertText($node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Found the custom 403 page'));
+ $this->assertText($node->title[LANGUAGE_NONE][0]['value'], t('Found the custom 403 page'));
$this->assertText(t('User login'), t('Blocks are shown on the custom 403 page'));
// Log back in and remove the custom 403 page.
@@ -607,8 +607,8 @@ class PageNotFoundTestCase extends DrupalWebTestCase {
$this->assertText(t('Page not found'), t('Found the default 404 page'));
$edit = array(
- 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(10)))),
- 'body' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(100)))),
+ 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(10)))),
+ 'body' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(100)))),
);
$node = $this->drupalCreateNode($edit);
@@ -616,7 +616,7 @@ class PageNotFoundTestCase extends DrupalWebTestCase {
$this->drupalPost('admin/config/system/site-information', array('site_404' => 'node/' . $node->nid), t('Save configuration'));
$this->drupalGet($this->randomName(10));
- $this->assertText($node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Found the custom 404 page'));
+ $this->assertText($node->title[LANGUAGE_NONE][0]['value'], t('Found the custom 404 page'));
}
}
@@ -880,7 +880,7 @@ class PageTitleFiltering extends DrupalWebTestCase {
drupal_set_title($title, PASS_THROUGH);
$this->assertTrue(strpos(drupal_get_title(), '<em>') !== FALSE, t('Tags in title are not converted to entities when $output is PASS_THROUGH.'));
// Generate node content.
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$edit = array(
"title[$langcode][0][value]" => '!SimpleTest! ' . $title . $this->randomName(20),
"body[$langcode][0][value]" => '!SimpleTest! test body' . $this->randomName(200),
@@ -1346,7 +1346,7 @@ class TokenReplaceTestCase extends DrupalWebTestCase {
// Create the initial objects.
$account = $this->drupalCreateUser();
$node = $this->drupalCreateNode(array('uid' => $account->uid));
- $node->title = array(FIELD_LANGUAGE_NONE => array(array('value' => '<blink>Blinking Text</blink>')));
+ $node->title = array(LANGUAGE_NONE => array(array('value' => '<blink>Blinking Text</blink>')));
global $user, $language;
$source = '[node:title]'; // Title of the node we passed in
@@ -1357,7 +1357,7 @@ class TokenReplaceTestCase extends DrupalWebTestCase {
$source .= '[date:short]'; // Short date format of REQUEST_TIME
$source .= '[bogus:token]'; // Nonexistent token, should be untouched
- $target = check_plain($node->title[FIELD_LANGUAGE_NONE][0]['value']);
+ $target = check_plain($node->title[LANGUAGE_NONE][0]['value']);
$target .= check_plain($account->name);
$target .= format_interval(REQUEST_TIME - $node->created, 2, $language->language);
$target .= check_plain($user->name);
@@ -1375,10 +1375,10 @@ class TokenReplaceTestCase extends DrupalWebTestCase {
$raw_tokens = array('title' => '[node:title]');
$generated = token_generate('node', $raw_tokens, array('node' => $node));
- $this->assertFalse(strcmp($generated['[node:title]'], check_plain($node->title[FIELD_LANGUAGE_NONE][0]['value'])), t('Token sanitized.'));
+ $this->assertFalse(strcmp($generated['[node:title]'], check_plain($node->title[LANGUAGE_NONE][0]['value'])), t('Token sanitized.'));
$generated = token_generate('node', $raw_tokens, array('node' => $node), array('sanitize' => FALSE));
- $this->assertFalse(strcmp($generated['[node:title]'], $node->title[FIELD_LANGUAGE_NONE][0]['value']), t('Unsanitized token generated properly.'));
+ $this->assertFalse(strcmp($generated['[node:title]'], $node->title[LANGUAGE_NONE][0]['value']), t('Unsanitized token generated properly.'));
}
}
diff --git a/modules/system/system.tokens.inc b/modules/system/system.tokens.inc
index fb42f1633..f7f27d057 100644
--- a/modules/system/system.tokens.inc
+++ b/modules/system/system.tokens.inc
@@ -283,7 +283,7 @@ function system_tokens($type, $tokens, array $data = array(), array $options = a
case 'node':
if ($nid = $file->nid) {
$node = node_load($file->nid);
- $replacements[$original] = $sanitize ? filter_xss($node->title[FIELD_LANGUAGE_NONE][0]['value']) : $node->title[FIELD_LANGUAGE_NONE][0]['value'];
+ $replacements[$original] = $sanitize ? filter_xss($node->title[LANGUAGE_NONE][0]['value']) : $node->title[LANGUAGE_NONE][0]['value'];
}
break;
diff --git a/modules/taxonomy/taxonomy.test b/modules/taxonomy/taxonomy.test
index 52c2c155b..726f29f15 100644
--- a/modules/taxonomy/taxonomy.test
+++ b/modules/taxonomy/taxonomy.test
@@ -378,7 +378,7 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
// Post an article.
$edit = array();
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$edit["title[$langcode][0][value]"] = $this->randomName();
$edit["body[$langcode][0][value]"] = $this->randomName();
$edit[$this->instance['field_name'] . '[' . $langcode .'][]'] = $term1->tid;
@@ -413,7 +413,7 @@ class TaxonomyTermTestCase extends TaxonomyWebTestCase {
);
$edit = array();
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$edit["title[$langcode][0][value]"] = $this->randomName();
$edit["body[$langcode][0][value]"] = $this->randomName();
// Insert the terms in a comma separated list. Vocabulary 1 is a
@@ -751,7 +751,7 @@ class TaxonomyTermFieldTestCase extends TaxonomyWebTestCase {
field_create_instance($this->instance);
// Test valid and invalid values with field_attach_validate().
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$entity = field_test_create_stub_entity();
$term = $this->createTerm($this->vocabulary);
$entity->{$this->field_name}[$langcode][0]['tid'] = $term->tid;
@@ -810,7 +810,7 @@ class TaxonomyTermFieldTestCase extends TaxonomyWebTestCase {
$term = $this->createTerm($this->vocabulary);
// Display creation form.
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$this->drupalGet('test-entity/add/test-bundle');
$this->assertFieldByName("{$this->field_name}[$langcode]", '', t('Widget is displayed'));
diff --git a/modules/tracker/tracker.test b/modules/tracker/tracker.test
index 8e5effe09..bd67fda5a 100644
--- a/modules/tracker/tracker.test
+++ b/modules/tracker/tracker.test
@@ -32,17 +32,17 @@ class TrackerTest extends DrupalWebTestCase {
$this->drupalLogin($this->user);
$unpublished = $this->drupalCreateNode(array(
- 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
+ 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
'status' => 0,
));
$published = $this->drupalCreateNode(array(
- 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
+ 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
'status' => 1,
));
$this->drupalGet('tracker');
- $this->assertNoText($unpublished->title[FIELD_LANGUAGE_NONE][0]['value'], t('Unpublished node do not show up in the tracker listing.'));
- $this->assertText($published->title[FIELD_LANGUAGE_NONE][0]['value'], t('Published node show up in the tracker listing.'));
+ $this->assertNoText($unpublished->title[LANGUAGE_NONE][0]['value'], t('Unpublished node do not show up in the tracker listing.'));
+ $this->assertText($published->title[LANGUAGE_NONE][0]['value'], t('Published node show up in the tracker listing.'));
$this->assertLink(t('My recent content'), 0, t('User tab shows up on the global tracker page.'));
}
@@ -53,22 +53,22 @@ class TrackerTest extends DrupalWebTestCase {
$this->drupalLogin($this->user);
$unpublished = $this->drupalCreateNode(array(
- 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
+ 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
'uid' => $this->user->uid,
'status' => 0,
));
$my_published = $this->drupalCreateNode(array(
- 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
+ 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
'uid' => $this->user->uid,
'status' => 1,
));
$other_published_no_comment = $this->drupalCreateNode(array(
- 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
+ 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
'uid' => $this->other_user->uid,
'status' => 1,
));
$other_published_my_comment = $this->drupalCreateNode(array(
- 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
+ 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
'uid' => $this->other_user->uid,
'status' => 1,
));
@@ -79,17 +79,17 @@ class TrackerTest extends DrupalWebTestCase {
$this->drupalPost('comment/reply/' . $other_published_my_comment->nid, $comment, t('Save'));
$this->drupalGet('user/' . $this->user->uid . '/track');
- $this->assertNoText($unpublished->title[FIELD_LANGUAGE_NONE][0]['value'], t("Unpublished nodes do not show up in the users's tracker listing."));
- $this->assertText($my_published->title[FIELD_LANGUAGE_NONE][0]['value'], t("Published nodes show up in the user's tracker listing."));
- $this->assertNoText($other_published_no_comment->title[FIELD_LANGUAGE_NONE][0]['value'], t("Other user's nodes do not show up in the user's tracker listing."));
- $this->assertText($other_published_my_comment->title[FIELD_LANGUAGE_NONE][0]['value'], t("Nodes that the user has commented on appear in the user's tracker listing."));
+ $this->assertNoText($unpublished->title[LANGUAGE_NONE][0]['value'], t("Unpublished nodes do not show up in the users's tracker listing."));
+ $this->assertText($my_published->title[LANGUAGE_NONE][0]['value'], t("Published nodes show up in the user's tracker listing."));
+ $this->assertNoText($other_published_no_comment->title[LANGUAGE_NONE][0]['value'], t("Other user's nodes do not show up in the user's tracker listing."));
+ $this->assertText($other_published_my_comment->title[LANGUAGE_NONE][0]['value'], t("Nodes that the user has commented on appear in the user's tracker listing."));
// Verify that unpublished comments are removed from the tracker.
$admin_user = $this->drupalCreateUser(array('administer comments', 'access user profiles'));
$this->drupalLogin($admin_user);
$this->drupalPost('comment/1/edit', array('status' => COMMENT_NOT_PUBLISHED), t('Save'));
$this->drupalGet('user/' . $this->user->uid . '/track');
- $this->assertNoText($other_published_my_comment->title[FIELD_LANGUAGE_NONE][0]['value'], 'Unpublished comments are not counted on the tracker listing.');
+ $this->assertNoText($other_published_my_comment->title[LANGUAGE_NONE][0]['value'], 'Unpublished comments are not counted on the tracker listing.');
}
/**
@@ -99,11 +99,11 @@ class TrackerTest extends DrupalWebTestCase {
$this->drupalLogin($this->user);
$edit = array(
- 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
+ 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
);
$node = $this->drupalCreateNode($edit);
- $title = $edit['title'][FIELD_LANGUAGE_NONE][0]['value'];
+ $title = $edit['title'][LANGUAGE_NONE][0]['value'];
$this->drupalGet('tracker');
$this->assertPattern('/' . $title . '.*new/', t('New nodes are flagged as such in the tracker listing.'));
@@ -128,7 +128,7 @@ class TrackerTest extends DrupalWebTestCase {
$node = $this->drupalCreateNode(array(
'comment' => 2,
- 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
+ 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName(8)))),
));
// Add a comment to the page.
@@ -170,7 +170,7 @@ class TrackerTest extends DrupalWebTestCase {
for ($i = 1; $i <= 3; $i++) {
$edits[$i] = array(
'comment' => 2,
- 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName()))),
+ 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName()))),
);
$nodes[$i] = $this->drupalCreateNode($edits[$i]);
}
@@ -200,7 +200,7 @@ class TrackerTest extends DrupalWebTestCase {
// Assert that all node titles are displayed.
foreach ($nodes as $i => $node) {
- $this->assertText($node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node @i is displayed on the tracker listing pages.', array('@i' => $i)));
+ $this->assertText($node->title[LANGUAGE_NONE][0]['value'], t('Node @i is displayed on the tracker listing pages.', array('@i' => $i)));
}
$this->assertText('1 new', t('New comment is counted on the tracker listing pages.'));
$this->assertText('updated', t('Node is listed as updated'));
@@ -211,7 +211,7 @@ class TrackerTest extends DrupalWebTestCase {
// Assert that all node titles are displayed.
foreach ($nodes as $i => $node) {
- $this->assertText($node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node @i is displayed on the tracker listing pages.', array('@i' => $i)));
+ $this->assertText($node->title[LANGUAGE_NONE][0]['value'], t('Node @i is displayed on the tracker listing pages.', array('@i' => $i)));
}
$this->assertText('1 new', t('New comment is counted on the tracker listing pages.'));
}
@@ -225,12 +225,12 @@ class TrackerTest extends DrupalWebTestCase {
$node = $this->drupalCreateNode(array(
'comment' => 2,
- 'title' => array(FIELD_LANGUAGE_NONE => array(array('value' => $this->randomName()))),
+ 'title' => array(LANGUAGE_NONE => array(array('value' => $this->randomName()))),
));
// Assert that the node is displayed.
$this->drupalGet('tracker');
- $this->assertText($node->title[FIELD_LANGUAGE_NONE][0]['value'], t('Node is displayed on the tracker listing pages.'));
+ $this->assertText($node->title[LANGUAGE_NONE][0]['value'], t('Node is displayed on the tracker listing pages.'));
// Unpublish the node and ensure that it's no longer displayed.
$edit = array(
diff --git a/modules/translation/translation.module b/modules/translation/translation.module
index 878c08308..9b8166942 100644
--- a/modules/translation/translation.module
+++ b/modules/translation/translation.module
@@ -76,7 +76,7 @@ function translation_menu() {
* all languages).
*/
function _translation_tab_access($node) {
- if (!empty($node->language) && translation_supported_type($node->type)) {
+ if ($node->language != LANGUAGE_NONE && translation_supported_type($node->type)) {
return user_access('translate content');
}
return FALSE;
@@ -122,7 +122,7 @@ function translation_form_alter(&$form, &$form_state, $form_id) {
// Disable languages for existing translations, so it is not possible to switch this
// node to some language which is already in the translation set. Also remove the
// language neutral option.
- unset($form['language']['#options']['']);
+ unset($form['language']['#options'][LANGUAGE_NONE]);
foreach (translation_node_get_translations($node->tnid) as $translation) {
if ($translation->nid != $node->nid) {
unset($form['language']['#options'][$translation->language]);
@@ -201,7 +201,7 @@ function translation_node_prepare($node) {
$translations = translation_node_get_translations($source_node->tnid);
if (isset($translations[$language])) {
$languages = language_list();
- drupal_set_message(t('A translation of %title in %language already exists, a new %type will be created instead of a translation.', array('%title' => $source_node->title[FIELD_LANGUAGE_NONE][0]['value'], '%language' => $languages[$language]->name, '%type' => $node->type)), 'error');
+ drupal_set_message(t('A translation of %title in %language already exists, a new %type will be created instead of a translation.', array('%title' => $source_node->title[LANGUAGE_NONE][0]['value'], '%language' => $languages[$language]->name, '%type' => $node->type)), 'error');
return;
}
}
diff --git a/modules/translation/translation.pages.inc b/modules/translation/translation.pages.inc
index aa2a72177..c5d38b179 100644
--- a/modules/translation/translation.pages.inc
+++ b/modules/translation/translation.pages.inc
@@ -33,7 +33,7 @@ function translation_node_overview($node) {
// Existing translation in the translation set: display status.
// We load the full node to check whether the user can edit it.
$translation_node = node_load($translations[$language->language]->nid);
- $title = l($translation_node->title[FIELD_LANGUAGE_NONE][0]['value'], 'node/' . $translation_node->nid);
+ $title = l($translation_node->title[LANGUAGE_NONE][0]['value'], 'node/' . $translation_node->nid);
if (node_access('update', $translation_node)) {
$options[] = l(t('edit'), "node/$translation_node->nid/edit");
}
@@ -54,7 +54,7 @@ function translation_node_overview($node) {
$rows[] = array($language_name, $title, $status, implode(" | ", $options));
}
- drupal_set_title(t('Translations of %title', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), PASS_THROUGH);
+ drupal_set_title(t('Translations of %title', array('%title' => $node->title[LANGUAGE_NONE][0]['value'])), PASS_THROUGH);
$build['translation_node_overview'] = array(
'#theme' => 'table',
diff --git a/modules/translation/translation.test b/modules/translation/translation.test
index c56c148c0..aea57ef2b 100644
--- a/modules/translation/translation.test
+++ b/modules/translation/translation.test
@@ -59,7 +59,7 @@ class TranslationTestCase extends DrupalWebTestCase {
// Attempt a resubmission of the form - this emulates using the back button
// to return to the page then resubmitting the form without a refresh.
$edit = array();
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$edit["title[$langcode][0][value]"] = $this->randomName();
$edit["body[$langcode][0][value]"] = $this->randomName();
$this->drupalPost('node/add/page', $edit, t('Save'), array('query' => array('translation' => $node->nid, 'language' => 'es')));
@@ -128,7 +128,7 @@ class TranslationTestCase extends DrupalWebTestCase {
*/
function createPage($title, $body, $language) {
$edit = array();
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$edit["title[$langcode][0][value]"] = $title;
$edit["body[$langcode][0][value]"] = $body;
$edit['language'] = $language;
@@ -154,7 +154,7 @@ class TranslationTestCase extends DrupalWebTestCase {
$this->drupalGet('node/add/page', array('query' => array('translation' => $nid, 'language' => $language)));
$edit = array();
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$edit["title[$langcode][0][value]"] = $title;
$edit["body[$language][0][value]"] = $body;
$this->drupalPost(NULL, $edit, t('Save'));
diff --git a/modules/trigger/trigger.test b/modules/trigger/trigger.test
index d7732fe02..382b7da1a 100644
--- a/modules/trigger/trigger.test
+++ b/modules/trigger/trigger.test
@@ -37,7 +37,7 @@ class TriggerContentTestCase extends DrupalWebTestCase {
$web_user = $this->drupalCreateUser(array('create page content', 'access content', 'administer nodes'));
$this->drupalLogin($web_user);
$edit = array();
- $langcode = FIELD_LANGUAGE_NONE;
+ $langcode = LANGUAGE_NONE;
$edit["title[$langcode][0][value]"] = '!SimpleTest test node! ' . $this->randomName(10);
$edit["body[$langcode][0][value]"] = '!SimpleTest test body! ' . $this->randomName(32) . ' ' . $this->randomName(32);
$edit[$info['property']] = !$info['expected'];
diff --git a/modules/upload/upload.test b/modules/upload/upload.test
index 09a297213..31873acc9 100644
--- a/modules/upload/upload.test
+++ b/modules/upload/upload.test
@@ -74,7 +74,7 @@ class UploadTestCase extends DrupalWebTestCase {
$edit = array();
$edit['files[' . $upload->fid . '][description]'] = $new_name = substr($upload->description, 1);
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
- $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), 'File renamed successfully.');
+ $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title[LANGUAGE_NONE][0]['value'])), 'File renamed successfully.');
$this->assertText($new_name, $new_name . ' found on node.');
$this->assertNoText($upload->description, $upload->description . ' not found on node.');
@@ -83,7 +83,7 @@ class UploadTestCase extends DrupalWebTestCase {
$edit = array();
$edit['files[' . $upload->fid . '][remove]'] = TRUE;
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
- $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), 'File deleted successfully.');
+ $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title[LANGUAGE_NONE][0]['value'])), 'File deleted successfully.');
$this->assertNoText($new_name, $new_name . ' not found on node.');
$uri = 'public://' . $upload->description;
@@ -197,7 +197,7 @@ class UploadTestCase extends DrupalWebTestCase {
$edit['files[upload]'] = $filename; //edit-upload
$this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
if ($assert) {
- $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title[FIELD_LANGUAGE_NONE][0]['value'])), 'File attached successfully.');
+ $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title[LANGUAGE_NONE][0]['value'])), 'File attached successfully.');
}
}