Commit 5981cc85 authored by gdd's avatar gdd

Merge remote-tracking branch 'origin/8.x' into 8.x-file-config

parents 01dbc00f 26394bec
......@@ -225,7 +225,7 @@ PHP module
- ?
Poll module
- ?
- Andrei Mateescu 'amateescu' <http://drupal.org/user/729614>
RDF module
- Stéphane Corlosquet 'scor' <http://drupal.org/user/52142>
......
......@@ -2967,6 +2967,18 @@ function drupal_get_css($css = NULL, $skip_alter = FALSE) {
// Sort CSS items, so that they appear in the correct order.
uasort($css, 'drupal_sort_css_js');
// Provide the page with information about the individual CSS files used,
// information not otherwise available when CSS aggregation is enabled. The
// setting is attached later in this function, but is set here, so that CSS
// files removed below are still considered "used" and prevented from being
// added in a later AJAX request.
// Skip if no files were added to the page or jQuery.extend() will overwrite
// the Drupal.settings.ajaxPageState.css object with an empty array.
if (!empty($css)) {
// Cast the array to an object to be on the safe side even if not empty.
$setting['ajaxPageState']['css'] = (object) array_fill_keys(array_keys($css), 1);
}
// Remove the overridden CSS files. Later CSS files override former ones.
$previous_item = array();
foreach ($css as $key => $item) {
......@@ -2986,14 +2998,7 @@ function drupal_get_css($css = NULL, $skip_alter = FALSE) {
'#type' => 'styles',
'#items' => $css,
);
// Provide the page with information about the individual CSS files used,
// information not otherwise available when CSS aggregation is enabled.
// Skip if no files were added to the page or jQuery.extend() will overwrite
// the Drupal.settings.ajaxPageState.css object with an empty array.
// Cast the array to an object to be on the safe side even if not empty.
if (!empty($css)) {
$setting['ajaxPageState']['css'] = (object) array_fill_keys(array_keys($css), 1);
if (!empty($setting)) {
$styles['#attached']['js'][] = array('type' => 'setting', 'data' => $setting);
}
......
......@@ -1035,6 +1035,13 @@ function theme($hook, $variables = array()) {
if (isset($info['base hook'])) {
$base_hook = $info['base hook'];
$base_hook_info = $hooks[$base_hook];
// Include files required by the base hook, since its variable processors
// might reside there.
if (!empty($base_hook_info['includes'])) {
foreach ($base_hook_info['includes'] as $include_file) {
include_once DRUPAL_ROOT . '/' . $include_file;
}
}
if (isset($base_hook_info['preprocess functions']) || isset($base_hook_info['process functions'])) {
$variables['theme_hook_suggestion'] = $hook;
$hook = $base_hook;
......
......@@ -73,7 +73,7 @@
'\x{A836}-\x{A839}\x{A874}-\x{A877}\x{A8CE}-\x{A8CF}\x{A8F8}-\x{A8FA}' .
'\x{A92E}-\x{A92F}\x{A95F}\x{A9C1}-\x{A9CD}\x{A9DE}-\x{A9DF}' .
'\x{AA5C}-\x{AA5F}\x{AA77}-\x{AA79}\x{AADE}-\x{AADF}\x{ABEB}' .
'\x{D800}-\x{F8FF}\x{FB29}\x{FD3E}-\x{FD3F}\x{FDFC}-\x{FDFD}' .
'\x{E000}-\x{F8FF}\x{FB29}\x{FD3E}-\x{FD3F}\x{FDFC}-\x{FDFD}' .
'\x{FE10}-\x{FE19}\x{FE30}-\x{FE6B}\x{FEFF}-\x{FF0F}\x{FF1A}-\x{FF20}' .
'\x{FF3B}-\x{FF40}\x{FF5B}-\x{FF65}\x{FFE0}-\x{FFFD}');
......
......@@ -77,9 +77,11 @@ Drupal.behaviors.machineName = {
$source.bind('keyup.machineName change.machineName', function () {
machine = self.transliterate($(this).val(), options);
// Set the machine name to the transliterated value.
if (machine != options.replace && machine != '') {
$target.val(machine);
$preview.text(machine);
if (machine != '') {
if (machine != options.replace) {
$target.val(machine);
$preview.text(machine);
}
$suffix.show();
}
else {
......
......@@ -17,7 +17,8 @@ Drupal.tableSelect = function () {
var table = this, checkboxes, lastChecked;
var strings = { 'selectAll': Drupal.t('Select all rows in this table'), 'selectNone': Drupal.t('Deselect all rows in this table') };
var updateSelectAll = function (state) {
$('th.select-all input:checkbox', table).each(function () {
// Update table's select-all checkbox (and sticky header's if available).
$(table).prev('table.sticky-header').andSelf().find('th.select-all input:checkbox').each(function() {
$(this).attr('title', state ? strings.selectNone : strings.selectAll);
this.checked = state;
});
......
......@@ -37,7 +37,7 @@ function aggregator_view() {
($feed->checked && $feed->refresh ? t('%time left', array('%time' => format_interval($feed->checked + $feed->refresh - REQUEST_TIME))) : t('never')),
l(t('edit'), "admin/config/services/aggregator/edit/feed/$feed->fid"),
l(t('remove items'), "admin/config/services/aggregator/remove/$feed->fid"),
l(t('update items'), "admin/config/services/aggregator/update/$feed->fid"),
l(t('update items'), "admin/config/services/aggregator/update/$feed->fid", array('query' => array('token' => drupal_get_token("aggregator/update/$feed->fid")))),
);
}
$output .= theme('table', array('header' => $header, 'rows' => $rows, 'empty' => t('No feeds available. <a href="@link">Add feed</a>.', array('@link' => url('admin/config/services/aggregator/add/feed')))));
......@@ -84,7 +84,7 @@ function aggregator_form_feed($form, &$form_state, stdClass $feed = NULL) {
$form['url'] = array('#type' => 'textfield',
'#title' => t('URL'),
'#default_value' => isset($feed->url) ? $feed->url : '',
'#maxlength' => 255,
'#maxlength' => NULL,
'#description' => t('The fully-qualified URL of the feed.'),
'#required' => TRUE,
);
......@@ -421,6 +421,9 @@ function _aggregator_parse_opml($opml) {
* @see aggregator_menu()
*/
function aggregator_admin_refresh_feed($feed) {
if (!isset($_GET['token']) || !drupal_valid_token($_GET['token'], 'aggregator/update/' . $feed->fid)) {
return MENU_ACCESS_DENIED;
}
aggregator_refresh($feed);
drupal_goto('admin/config/services/aggregator');
}
......
......@@ -130,10 +130,8 @@ function aggregator_schema() {
'description' => 'Title of the feed.',
),
'url' => array(
'type' => 'varchar',
'length' => 255,
'type' => 'text',
'not null' => TRUE,
'default' => '',
'description' => 'URL to the feed.',
),
'refresh' => array(
......@@ -155,10 +153,8 @@ function aggregator_schema() {
'description' => 'Time when this feed was queued for refresh, 0 if not queued.',
),
'link' => array(
'type' => 'varchar',
'length' => 255,
'type' => 'text',
'not null' => TRUE,
'default' => '',
'description' => 'The parent website of the feed; comes from the <link> element in the feed.',
),
'description' => array(
......@@ -202,13 +198,13 @@ function aggregator_schema() {
)
),
'primary key' => array('fid'),
'unique keys' => array(
'url' => array('url'),
'title' => array('title'),
),
'indexes' => array(
'url' => array(array('url', 255)),
'queued' => array('queued'),
),
'unique keys' => array(
'title' => array('title'),
),
);
$schema['aggregator_item'] = array(
......@@ -233,10 +229,8 @@ function aggregator_schema() {
'description' => 'Title of the feed item.',
),
'link' => array(
'type' => 'varchar',
'length' => 255,
'type' => 'text',
'not null' => TRUE,
'default' => '',
'description' => 'Link to the feed item.',
),
'author' => array(
......@@ -258,9 +252,8 @@ function aggregator_schema() {
'description' => 'Posted date of the feed item, as a Unix timestamp.',
),
'guid' => array(
'type' => 'varchar',
'length' => 255,
'not null' => FALSE,
'type' => 'text',
'not null' => TRUE,
'description' => 'Unique identifier for the feed item.',
)
),
......
......@@ -537,6 +537,7 @@ function aggregator_save_feed($edit) {
'url' => $edit['url'],
'refresh' => $edit['refresh'],
'block' => $edit['block'],
'link' => '',
'description' => '',
'image' => '',
))
......@@ -573,15 +574,13 @@ function aggregator_remove($feed) {
// Call hook_aggregator_remove() on all modules.
module_invoke_all('aggregator_remove', $feed);
// Reset feed.
db_merge('aggregator_feed')
->key(array('fid' => $feed->fid))
db_update('aggregator_feed')
->condition('fid', $feed->fid)
->fields(array(
'checked' => 0,
'hash' => '',
'etag' => '',
'modified' => 0,
'description' => $feed->description,
'image' => $feed->image,
))
->execute();
}
......
......@@ -92,8 +92,13 @@ class AggregatorTestCase extends DrupalWebTestCase {
$this->drupalGet($feed->url);
$this->assertResponse(200, t('!url is reachable.', array('!url' => $feed->url)));
// Refresh the feed (simulated link click).
// Attempt to access the update link directly without an access token.
$this->drupalGet('admin/config/services/aggregator/update/' . $feed->fid);
$this->assertResponse(403);
// Refresh the feed (simulated link click).
$this->drupalGet('admin/config/services/aggregator');
$this->clickLink('update items');
// Ensure we have the right number of items.
$result = db_query('SELECT iid FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->fid));
......@@ -349,6 +354,35 @@ class AddFeedTestCase extends AggregatorTestCase {
// Delete feed.
$this->deleteFeed($feed);
}
/**
* Tests feeds with very long URLs.
*/
function testAddLongFeed() {
// Create a feed with a URL of > 255 characters.
$long_url = "https://www.google.com/search?ix=heb&sourceid=chrome&ie=UTF-8&q=angie+byron#sclient=psy-ab&hl=en&safe=off&source=hp&q=angie+byron&pbx=1&oq=angie+byron&aq=f&aqi=&aql=&gs_sm=3&gs_upl=0l0l0l10534l0l0l0l0l0l0l0l0ll0l0&bav=on.2,or.r_gc.r_pw.r_cp.,cf.osb&fp=a70b6b1f0abe28d8&biw=1629&bih=889&ix=heb";
$feed = $this->createFeed($long_url);
// Create a second feed of > 255 characters, where the only difference is
// after the 255th character.
$long_url_2 = "https://www.google.com/search?ix=heb&sourceid=chrome&ie=UTF-8&q=angie+byron#sclient=psy-ab&hl=en&safe=off&source=hp&q=angie+byron&pbx=1&oq=angie+byron&aq=f&aqi=&aql=&gs_sm=3&gs_upl=0l0l0l10534l0l0l0l0l0l0l0l0ll0l0&bav=on.2,or.r_gc.r_pw.r_cp.,cf.osb&fp=a70b6b1f0abe28d8&biw=1629&bih=889";
$feed_2 = $this->createFeed($long_url_2);
// Check feed data.
$this->assertTrue($this->uniqueFeed($feed->title, $feed->url), 'The first long URL feed is unique.');
$this->assertTrue($this->uniqueFeed($feed_2->title, $feed_2->url), 'The second long URL feed is unique.');
// Check feed source.
$this->drupalGet('aggregator/sources/' . $feed->fid);
$this->assertResponse(200, 'Long URL feed source exists.');
$this->assertText($feed->title, 'Page title');
$this->drupalGet('aggregator/sources/' . $feed->fid . '/categorize');
$this->assertResponse(200, 'Long URL feed categorization page exists.');
// Delete feeds.
$this->deleteFeed($feed);
$this->deleteFeed($feed_2);
}
}
class CategorizeFeedTestCase extends AggregatorTestCase {
......@@ -502,8 +536,8 @@ class UpdateFeedItemTestCase extends AggregatorTestCase {
$this->assertRaw(t('The feed %name has been added.', array('%name' => $edit['title'])), t('The feed !name has been added.', array('!name' => $edit['title'])));
$feed = db_query("SELECT * FROM {aggregator_feed} WHERE url = :url", array(':url' => $edit['url']))->fetchObject();
$this->drupalGet('admin/config/services/aggregator/update/' . $feed->fid);
aggregator_refresh($feed);
$before = db_query('SELECT timestamp FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->fid))->fetchField();
// Sleep for 3 second.
......@@ -517,10 +551,9 @@ class UpdateFeedItemTestCase extends AggregatorTestCase {
'modified' => 0,
))
->execute();
$this->drupalGet('admin/config/services/aggregator/update/' . $feed->fid);
aggregator_refresh($feed);
$after = db_query('SELECT timestamp FROM {aggregator_item} WHERE fid = :fid', array(':fid' => $feed->fid))->fetchField();
$this->assertTrue($before === $after, t('Publish timestamp of feed item was not updated (!before === !after)', array('!before' => $before, '!after' => $after)));
}
}
......
......@@ -18,8 +18,8 @@
* @ingroup themeable
*/
?>
<div id="node-<?php print $node->nid; ?>" class="section-<?php print $depth; ?>">
<article id="node-<?php print $node->nid; ?>" class="section-<?php print $depth; ?>">
<h1 class="book-heading"><?php print $title; ?></h1>
<?php print $content; ?>
<?php print $children; ?>
</div>
</article>
......@@ -691,16 +691,16 @@ function field_info_field_by_ids() {
*/
function field_info_instances($entity_type = NULL, $bundle_name = NULL) {
$info = _field_info_collate_fields();
if (!isset($entity_type)) {
return $info['instances'];
if (isset($entity_type) && isset($bundle_name)) {
return isset($info['instances'][$entity_type][$bundle_name]) ? $info['instances'][$entity_type][$bundle_name] : array();
}
if (!isset($bundle_name)) {
return $info['instances'][$entity_type];
elseif (isset($entity_type)) {
return isset($info['instances'][$entity_type]) ? $info['instances'][$entity_type] : array();
}
if (isset($info['instances'][$entity_type][$bundle_name])) {
return $info['instances'][$entity_type][$bundle_name];
else {
return $info['instances'];
}
return array();
}
/**
......
......@@ -454,8 +454,8 @@ class TextTranslationTestCase extends DrupalWebTestCase {
$langcode = LANGUAGE_NONE;
$body = $this->randomName();
$edit = array(
"title" => $this->randomName(),
"language" => 'en',
'title' => $this->randomName(),
'langcode' => 'en',
"body[$langcode][0][value]" => $body,
);
......@@ -487,7 +487,7 @@ class TextTranslationTestCase extends DrupalWebTestCase {
$title = $this->randomName();
$edit = array(
'title' => $title,
'language' => 'en',
'langcode' => 'en',
);
$this->drupalPost('node/add/article', $edit, t('Save'));
......
......@@ -1079,11 +1079,14 @@ class FieldInfoTestCase extends FieldTestCase {
}
// Verify that no unexpected instances exist.
$core_fields = field_info_fields();
$instances = field_info_instances('test_entity');
$expected = array('test_bundle' => array());
$this->assertIdentical($instances, $expected, "field_info_instances('test_entity') returns " . var_export($expected, TRUE) . '.');
$instances = field_info_instances('test_entity', 'test_bundle');
$this->assertTrue(empty($instances), t('With no instances, info bundles is empty.'));
$this->assertIdentical($instances, array(), "field_info_instances('test_entity', 'test_bundle') returns an empty array.");
// Create a field, verify it shows up.
$core_fields = field_info_fields();
$field = array(
'field_name' => drupal_strtolower($this->randomName()),
'type' => 'test_field',
......@@ -1119,6 +1122,25 @@ class FieldInfoTestCase extends FieldTestCase {
$instances = field_info_instances('test_entity', $instance['bundle']);
$this->assertEqual(count($instances), 1, t('One instance shows up in info when attached to a bundle.'));
$this->assertTrue($instance < $instances[$instance['field_name']], t('Instance appears in info correctly'));
// Test a valid entity type but an invalid bundle.
$instances = field_info_instances('test_entity', 'invalid_bundle');
$this->assertIdentical($instances, array(), "field_info_instances('test_entity', 'invalid_bundle') returns an empty array.");
// Test invalid entity type and bundle.
$instances = field_info_instances('invalid_entity', $instance['bundle']);
$this->assertIdentical($instances, array(), "field_info_instances('invalid_entity', 'test_bundle') returns an empty array.");
// Test invalid entity type, no bundle provided.
$instances = field_info_instances('invalid_entity');
$this->assertIdentical($instances, array(), "field_info_instances('invalid_entity') returns an empty array.");
// Test with an entity type that has no bundles.
$instances = field_info_instances('user');
$expected = array('user' => array());
$this->assertIdentical($instances, $expected, "field_info_instances('user') returns " . var_export($expected, TRUE) . '.');
$instances = field_info_instances('user', 'user');
$this->assertIdentical($instances, array(), "field_info_instances('user', 'user') returns an empty array.");
}
/**
......
......@@ -293,8 +293,8 @@ function theme_field_ui_table($variables) {
* The resulting form allows fields and pseudo-fields to be re-ordered.
*
* @see field_ui_menu()
* @see field_ui_overview_form_validate().
* @see field_ui_overview_form_submit().
* @see field_ui_field_overview_form_validate()
* @see field_ui_field_overview_form_submit()
* @ingroup forms
*/
function field_ui_field_overview_form($form, &$form_state, $entity_type, $bundle) {
......@@ -1744,7 +1744,7 @@ function field_ui_widget_type_form_submit($form, &$form_state) {
* hook_entity_info().
*
* @see field_ui_menu()
* @see field_ui_delete_form_submit()
* @see field_ui_field_delete_form_submit()
* @ingroup forms
*/
function field_ui_field_delete_form($form, &$form_state, $instance) {
......
......@@ -1128,7 +1128,7 @@ function filter_dom_serialize_escape_cdata_element($dom_document, $dom_element,
* @ingroup themeable
*/
function theme_filter_tips_more_info() {
return '<p>' . l(t('More information about text formats'), 'filter/tips') . '</p>';
return '<p>' . l(t('More information about text formats'), 'filter/tips', array('attributes' => array('target' => '_blank'))) . '</p>';
}
/**
......
......@@ -264,13 +264,25 @@ function locale_update_8001() {
// storing data for blocks will need to update for themselves.
$block_tables = array('block', 'block_node_type', 'block_role');
foreach ($block_tables as $table) {
db_update($table)
->fields(array(
'delta' => 'language_interface',
))
->condition('delta', 'language')
->condition('module', 'locale')
->execute();
// Perform the update only if the language switcher block data is available.
$block_data = db_query_range('SELECT 1 FROM {' . $table . '} WHERE delta = :delta AND module = :module', 0, 1, array(':delta' => 'language', ':module' => 'locale'))
->fetchField();
if ($block_data) {
// If block information is rebuilt before performing the update, we might
// already have data for the new delta. In this case we need to remove it
// to avoid integrity constraint violation errors.
db_delete($table)
->condition('delta', 'language_interface')
->condition('module', 'locale')
->execute();
db_update($table)
->fields(array(
'delta' => 'language_interface',
))
->condition('delta', 'language')
->condition('module', 'locale')
->execute();
}
}
}
......
......@@ -292,13 +292,13 @@ function locale_field_node_form_submit($form, &$form_state) {
foreach (field_info_instances('node', $bundle) as $instance) {
$field_name = $instance['field_name'];
$field = field_info_field($field_name);
$previous_language = $form[$field_name]['#language'];
$previous_langcode = $form[$field_name]['#language'];
// Handle a possible language change: new language values are inserted,
// previous ones are deleted.
if ($field['translatable'] && $previous_language != $node->language) {
$form_state['values'][$field_name][$node->language] = $node->{$field_name}[$previous_language];
$form_state['values'][$field_name][$previous_language] = array();
if ($field['translatable'] && $previous_langcode != $node->langcode) {
$form_state['values'][$field_name][$node->langcode] = $node->{$field_name}[$previous_langcode];
$form_state['values'][$field_name][$previous_langcode] = array();
}
}
}
......@@ -1085,15 +1085,15 @@ function locale_form_system_file_system_settings_alter(&$form, $form_state) {
* Implements MODULE_preprocess_HOOK().
*/
function locale_preprocess_node(&$variables) {
if ($variables['language'] != LANGUAGE_NONE) {
if ($variables['langcode'] != LANGUAGE_NONE) {
global $language_interface;
$node_language = language_load($variables['language']);
$node_language = language_load($variables['langcode']);
if ($node_language->langcode != $language_interface->langcode) {
// If the node language was different from the page language, we should
// add markup to identify the language. Otherwise the page language is
// inherited.
$variables['attributes_array']['lang'] = $variables['language'];
$variables['attributes_array']['lang'] = $variables['langcode'];
if ($node_language->direction != $language_interface->direction) {
// If text direction is different form the page's text direction, add
// direction information as well.
......
......@@ -2002,7 +2002,7 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase {
// Verify language selection appears on add "Basic page" form.
$this->drupalGet('node/add/page');
// Verify language select list is present.
$this->assertFieldByName('language', NULL, t('Language select present on add Basic page form.'));
$this->assertFieldByName('langcode', NULL, t('Language select present on add Basic page form.'));
// Ensure enabled language appears.
$this->assertText($name, t('Enabled language present.'));
// Ensure disabled language doesn't appear.
......@@ -2015,7 +2015,7 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase {
'type' => 'page',
'title' => $node_title,
'body' => array($langcode => array(array('value' => $node_body))),
'language' => $langcode,
'langcode' => $langcode,
);
$node = $this->drupalCreateNode($edit);
// Edit the content and ensure correct language is selected.
......@@ -2024,7 +2024,7 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase {
$this->assertRaw('<option value="' . $langcode . '" selected="selected">' . $name . '</option>', t('Correct language selected.'));
// Ensure we can change the node language.
$edit = array(
'language' => 'en',
'langcode' => 'en',
);
$this->drupalPost($path, $edit, t('Save'));
$this->assertRaw(t('%title has been updated.', array('%title' => $node_title)), t('Basic page content updated.'));
......@@ -2107,7 +2107,7 @@ class LocaleContentFunctionalTest extends DrupalWebTestCase {
'type' => 'article',
'title' => $node_title,
'body' => array($langcode => array(array('value' => $node_body))),
'language' => $langcode,
'langcode' => $langcode,
'promote' => 1,
);
return $this->drupalCreateNode($edit);
......@@ -2575,7 +2575,7 @@ class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase {
$edit = array();
$edit[$title_key] = $title_value;
$edit[$body_key] = $body_value;
$edit['language'] = 'en';
$edit['langcode'] = 'en';
$this->drupalPost('node/add/page', $edit, t('Save'));
// Check that the node exists in the database.
......@@ -2589,7 +2589,7 @@ class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase {
$this->drupalGet("node/$node->nid/edit");
$edit = array(
$title_key => $this->randomName(8),
'language' => 'it'
'langcode' => 'it'
);
$this->drupalPost(NULL, $edit, t('Save'));
$node = $this->drupalGetNodeByTitle($edit[$title_key]);
......@@ -2624,7 +2624,7 @@ class LocaleMultilingualFieldsFunctionalTest extends DrupalWebTestCase {
$edit = array();
$edit[$title_key] = $title_value;
$edit[$body_key] = $body_value;
$edit['language'] = 'en';
$edit['langcode'] = 'en';
$this->drupalPost('node/add/page', $edit, t('Save'));
// Check that the node exists in the database.
......@@ -2706,7 +2706,7 @@ class LocaleCommentLanguageFunctionalTest extends DrupalWebTestCase {
$edit = array(
"title" => $title,
"body[$langcode_none][0][value]" => $this->randomName(),
"language" => $node_langcode,
"langcode" => $node_langcode,
);
$this->drupalPost("node/add/article", $edit, t('Save'));
$node = $this->drupalGetNodeByTitle($title);
......
......@@ -435,7 +435,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_range("SELECT 1 FROM {node} WHERE language <> :language", 0, 1, array(':language' => LANGUAGE_NONE))->fetchField());
$multilanguage = (module_exists('translation') || db_query_range("SELECT 1 FROM {node} WHERE langcode <> :langcode", 0, 1, array(':langcode' => LANGUAGE_NONE))->fetchField());
// Build the sortable table header.
$header = array(
......@@ -446,7 +446,7 @@ function node_admin_nodes() {
'changed' => array('data' => t('Updated'), 'field' => 'n.changed', 'sort' => 'desc')
);
if ($multilanguage) {
$header['language_name'] = array('data' => t('Language'), 'field' => 'n.language');
$header['language_name'] = array('data' => t('Language'), 'field' => 'n.langcode');
}
$header['operations'] = array('data' => t('Operations'));
......@@ -481,7 +481,7 @@ function node_admin_nodes() {
$destination = drupal_get_destination();
$options = array();
foreach ($nodes as $node) {
$l_options = $node->language != LANGUAGE_NONE && isset($languages[$node->language]) ? array('language' => $languages[$node->language]) : array();
$l_options = $node->langcode != LANGUAGE_NONE && isset($languages[$node->langcode]) ? array('language' => $languages[$node->langcode]) : array();
$options[$node->nid] = array(
'title' => array(
'data' => array(
......@@ -498,7 +498,7 @@ function node_admin_nodes() {
'changed' => format_date($node->changed, 'short'),
);
if ($multilanguage) {
$options[$node->nid]['language_name'] = language_name($node->language);
$options[$node->nid]['language_name'] = language_name($node->langcode);
}
// Build a list of all the accessible operations for the current node.
$operations = array();
......
......@@ -32,7 +32,7 @@ function node_schema() {
'not null' => TRUE,
'default' => '',
),
'language' => array(
'langcode' => array(
'description' => 'The {language}.langcode of this node.',
'type' => 'varchar',
'length' => 12,
......@@ -541,6 +541,20 @@ function node_update_8001() {
}
}
/**
* Rename node.language field to node.langcode.
*/
function node_update_8002() {
$spec = array(
'description' => 'The {language}.langcode of this node.',
'type' => 'varchar',
'length' => 12,
'not null' => TRUE,
'default' => '',
);
db_change_field('node', 'language', 'langcode', $spec);
}
/**
* @} End of "addtogroup updates-7.x-to-8.x"
* The next series of updates should start at 9000.
......
......@@ -1340,7 +1340,7 @@ function node_view($node, $view_mode = 'full', $langcode = NULL) {
'#theme' => 'node',
'#node' => $node,
'#view_mode' => $view_mode,
'#language' => $langcode,
'#langcode' => $langcode,
);
// Add contextual links for this node, except when the node is already being
......@@ -1724,7 +1724,7 @@ function node_search_execute($keys = NULL, $conditions = NULL) {
// Insert special keywords.
$query->setOption('type', 'n.type');
$query->setOption('language', 'n.language');
$query->setOption('langcode', 'n.langcode');
if ($query->setOption('term', 'ti.tid')) {
$query->join('taxonomy_index', 'ti', 'n.nid = ti.nid');
}
......@@ -1764,7 +1764,7 @@ function node_search_execute($keys = NULL, $conditions = NULL) {
'extra' => $extra,
'score' => $item->calculated_score,
'snippet' => search_excerpt($keys, $node->rendered),
'language' => $node->language,
'langcode' => $node->langcode,
);
}
return $results;
......@@ -2848,10 +2848,8 @@ function node_form_search_form_alter(&$form, $form_state) {
// Languages:
$language_options = array();
foreach (language_list() as $key => $entity) {
if ($entity->enabled) {
$language_options[$key] = $entity->name;
}
foreach (language_list(TRUE) as $langcode => $language) {
$language_options[$langcode] = $language->name;
}
if (count($language_options) > 1) {
$form['advanced']['language'] = array(
......@@ -4204,9 +4202,9 @@ function node_file_download_access($field, $entity_type, $entity) {
* Implements hook_language_delete().
*/
function node_language_delete($language) {
// On nodes with this language, unset the language
// On nodes with this language, unset the language.
db_update('node')
->fields(array('language' => ''))
->condition('language', $language->langcode)
->fields(array('langcode' => ''))
->condition('langcode', $language->langcode)
->execute();
}
......@@ -87,7 +87,7 @@ function node_add($type) {
global $user;
$types = node_type_get_types();
$node = (object) array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => $type, 'language' => LANGUAGE_NONE);
$node = (object) array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => $type, 'langcode' => LANGUAGE_NONE);