summaryrefslogtreecommitdiff
path: root/modules/node
diff options
context:
space:
mode:
Diffstat (limited to 'modules/node')
-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
6 files changed, 85 insertions, 75 deletions
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;