update core to 7.36

This commit is contained in:
Bachir Soussi Chiadmi
2015-04-19 19:33:23 +02:00
parent 6de56c702c
commit 802ec0c6f3
271 changed files with 4111 additions and 1227 deletions

View File

@@ -17,11 +17,14 @@
* During node operations (create, update, view, delete, etc.), there are
* several sets of hooks that get invoked to allow modules to modify the base
* node operation:
* - Node-type-specific hooks: These hooks are only invoked on the primary
* module, using the "base" return component of hook_node_info() as the
* function prefix. For example, poll.module defines the base for the Poll
* content type as "poll", so during creation of a poll node, hook_insert() is
* only invoked by calling poll_insert().
* - Node-type-specific hooks: When defining a node type, hook_node_info()
* returns a 'base' component. Node-type-specific hooks are named
* base_hookname() instead of mymodule_hookname() (in a module called
* 'mymodule' for example). Only the node type's corresponding implementation
* is invoked. For example, poll_node_info() in poll.module defines the base
* for the 'poll' node type as 'poll'. So when a poll node is created,
* hook_insert() is invoked on poll_insert() only.
* Hooks that are node-type-specific are noted below.
* - All-module hooks: This set of hooks is invoked on all implementing modules,
* to allow other modules to modify what the primary node module is doing. For
* example, hook_node_insert() is invoked on all modules when creating a poll
@@ -195,7 +198,7 @@ function hook_node_grants($account, $op) {
if (user_access('access private content', $account)) {
$grants['example'] = array(1);
}
$grants['example_owner'] = array($account->uid);
$grants['example_author'] = array($account->uid);
return $grants;
}
@@ -885,11 +888,10 @@ function hook_node_view_alter(&$build) {
* name as the key. Each sub-array has up to 10 attributes. Possible
* attributes:
* - name: (required) The human-readable name of the node type.
* - base: (required) The base string used to construct callbacks
* corresponding to this node type (for example, if base is defined as
* example_foo, then example_foo_insert will be called when inserting a node
* of that type). This string is usually the name of the module, but not
* always.
* - base: (required) The base name for implementations of node-type-specific
* hooks that respond to this node type. Base is usually the name of the
* module or 'node_content', but not always. See
* @link node_api_hooks Node API hooks @endlink for more information.
* - description: (required) A brief description of the node type.
* - help: (optional) Help information shown to the user when creating a node
* of this type.
@@ -1030,8 +1032,11 @@ function hook_node_type_delete($info) {
/**
* Respond to node deletion.
*
* This hook is invoked only on the module that defines the node's content type
* (use hook_node_delete() to respond to all node deletions).
* This is a node-type-specific hook, which is invoked only for the node type
* being affected. See
* @link node_api_hooks Node API hooks @endlink for more information.
*
* Use hook_node_delete() to respond to node deletion of all node types.
*
* This hook is invoked from node_delete_multiple() before hook_node_delete()
* is invoked and before field_attach_delete() is called.
@@ -1059,8 +1064,11 @@ function hook_delete($node) {
/**
* Act on a node object about to be shown on the add/edit form.
*
* This hook is invoked only on the module that defines the node's content type
* (use hook_node_prepare() to act on all node preparations).
* This is a node-type-specific hook, which is invoked only for the node type
* being affected. See
* @link node_api_hooks Node API hooks @endlink for more information.
*
* Use hook_node_prepare() to respond to node preparation of all node types.
*
* This hook is invoked from node_object_prepare() before the general
* hook_node_prepare() is invoked.
@@ -1089,6 +1097,13 @@ function hook_prepare($node) {
/**
* Display a node editing form.
*
* This is a node-type-specific hook, which is invoked only for the node type
* being affected. See
* @link node_api_hooks Node API hooks @endlink for more information.
*
* Use hook_form_BASE_FORM_ID_alter(), with base form ID 'node_form', to alter
* node forms for all node types.
*
* This hook, implemented by node modules, is called to retrieve the form
* that is displayed to create or edit a node. This form is displayed at path
* node/add/[node type] or node/[node ID]/edit.
@@ -1144,8 +1159,11 @@ function hook_form($node, &$form_state) {
/**
* Respond to creation of a new node.
*
* This hook is invoked only on the module that defines the node's content type
* (use hook_node_insert() to act on all node insertions).
* This is a node-type-specific hook, which is invoked only for the node type
* being affected. See
* @link node_api_hooks Node API hooks @endlink for more information.
*
* Use hook_node_insert() to respond to node insertion of all node types.
*
* This hook is invoked from node_save() after the node is inserted into the
* node table in the database, before field_attach_insert() is called, and
@@ -1168,8 +1186,11 @@ function hook_insert($node) {
/**
* Act on nodes being loaded from the database.
*
* This hook is invoked only on the module that defines the node's content type
* (use hook_node_load() to respond to all node loads).
* This is a node-type-specific hook, which is invoked only for the node type
* being affected. See
* @link node_api_hooks Node API hooks @endlink for more information.
*
* Use hook_node_load() to respond to node load of all node types.
*
* This hook is invoked during node loading, which is handled by entity_load(),
* via classes NodeController and DrupalDefaultEntityController. After the node
@@ -1202,8 +1223,11 @@ function hook_load($nodes) {
/**
* Respond to updates to a node.
*
* This hook is invoked only on the module that defines the node's content type
* (use hook_node_update() to act on all node updates).
* This is a node-type-specific hook, which is invoked only for the node type
* being affected. See
* @link node_api_hooks Node API hooks @endlink for more information.
*
* Use hook_node_update() to respond to node update of all node types.
*
* This hook is invoked from node_save() after the node is updated in the
* node table in the database, before field_attach_update() is called, and
@@ -1224,8 +1248,11 @@ function hook_update($node) {
/**
* Perform node validation before a node is created or updated.
*
* This hook is invoked only on the module that defines the node's content type
* (use hook_node_validate() to act on all node validations).
* This is a node-type-specific hook, which is invoked only for the node type
* being affected. See
* @link node_api_hooks Node API hooks @endlink for more information.
*
* Use hook_node_validate() to respond to node validation of all node types.
*
* This hook is invoked from node_validate(), after a user has finished
* editing the node and is previewing or submitting it. It is invoked at the end
@@ -1258,8 +1285,11 @@ function hook_validate($node, $form, &$form_state) {
/**
* Display a node.
*
* This hook is invoked only on the module that defines the node's content type
* (use hook_node_view() to act on all node views).
* This is a node-type-specific hook, which is invoked only for the node type
* being affected. See
* @link node_api_hooks Node API hooks @endlink for more information.
*
* Use hook_node_view() to respond to node view of all node types.
*
* This hook is invoked during node viewing after the node is fully loaded, so
* that the node type module can define a custom method for display, or add to
@@ -1269,6 +1299,10 @@ function hook_validate($node, $form, &$form_state) {
* The node to be displayed, as returned by node_load().
* @param $view_mode
* View mode, e.g. 'full', 'teaser', ...
* @param $langcode
* (optional) A language code to use for rendering. Defaults to the global
* content language of the current request.
*
* @return
* The passed $node parameter should be modified as necessary and returned so
* it can be properly presented. Nodes are prepared for display by assembling
@@ -1282,7 +1316,7 @@ function hook_validate($node, $form, &$form_state) {
*
* @ingroup node_api_hooks
*/
function hook_view($node, $view_mode) {
function hook_view($node, $view_mode, $langcode = NULL) {
if ($view_mode == 'full' && node_is_page($node)) {
$breadcrumb = array();
$breadcrumb[] = l(t('Home'), NULL);

View File

@@ -9,8 +9,8 @@ required = TRUE
configure = admin/structure/types
stylesheets[all][] = node.css
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -210,7 +210,7 @@ function node_entity_info() {
'custom settings' => FALSE,
),
'search_result' => array(
'label' => t('Search result'),
'label' => t('Search result highlighting input'),
'custom settings' => FALSE,
),
);
@@ -506,7 +506,8 @@ function node_type_load($name) {
* - custom: TRUE or FALSE indicating whether this type is defined by a module
* (FALSE) or by a user (TRUE) via Add Content Type.
* - modified: TRUE or FALSE indicating whether this type has been modified by
* an administrator. Currently not used in any way.
* an administrator. When modifying an existing node type, set to TRUE, or
* the change will be ignored on node_types_rebuild().
* - locked: TRUE or FALSE indicating whether the administrator can change the
* machine name of this type.
* - disabled: TRUE or FALSE indicating whether this type has been disabled.
@@ -739,11 +740,9 @@ function _node_types_build($rebuild = FALSE) {
$type_db = $type_object->type;
// Original disabled value.
$disabled = $type_object->disabled;
// Check for node types from disabled modules and mark their types for removal.
// Types defined by the node module in the database (rather than by a separate
// module using hook_node_info) have a base value of 'node_content'. The isset()
// check prevents errors on old (pre-Drupal 7) databases.
if (isset($type_object->base) && $type_object->base != 'node_content' && empty($_node_types->types[$type_db])) {
// Check for node types either from disabled modules or otherwise not defined
// and mark as disabled.
if (empty($type_object->custom) && empty($_node_types->types[$type_db])) {
$type_object->disabled = TRUE;
}
if (isset($_node_types->types[$type_db])) {
@@ -1397,12 +1396,7 @@ function node_build_content($node, $view_mode = 'full', $langcode = NULL) {
$node->content = array();
// Allow modules to change the view mode.
$context = array(
'entity_type' => 'node',
'entity' => $node,
'langcode' => $langcode,
);
drupal_alter('entity_view_mode', $view_mode, $context);
$view_mode = key(entity_view_mode_prepare('node', array($node->nid => $node), $view_mode, $langcode));
// The 'view' hook can be implemented to overwrite the default function
// to display nodes.
@@ -1585,9 +1579,7 @@ function node_permission() {
),
'access content overview' => array(
'title' => t('Access the content overview page'),
'description' => user_access('access content overview')
? t('Get an overview of <a href="@url">all content</a>.', array('@url' => url('admin/content')))
: t('Get an overview of all content.'),
'description' => t('Get an overview of <a href="@url">all content</a>.', array('@url' => url('admin/content'))),
),
'access content' => array(
'title' => t('View published content'),
@@ -1615,7 +1607,7 @@ function node_permission() {
}
/**
* Gathers the rankings from the the hook_ranking() implementations.
* Gathers the rankings from the hook_ranking() implementations.
*
* @param $query
* A query object that has been extended with the Search DB Extender.
@@ -2604,9 +2596,10 @@ function node_feed($nids = FALSE, $channel = array()) {
$node->link = url("node/$node->nid", array('absolute' => TRUE));
$node->rss_namespaces = array();
$account = user_load($node->uid);
$node->rss_elements = array(
array('key' => 'pubDate', 'value' => gmdate('r', $node->created)),
array('key' => 'dc:creator', 'value' => $node->name),
array('key' => 'dc:creator', 'value' => format_username($account)),
array('key' => 'guid', 'value' => $node->nid . ' at ' . $base_url, 'attributes' => array('isPermaLink' => 'false'))
);
@@ -2664,15 +2657,26 @@ function node_feed($nids = FALSE, $channel = array()) {
* An array in the format expected by drupal_render().
*/
function node_view_multiple($nodes, $view_mode = 'teaser', $weight = 0, $langcode = NULL) {
field_attach_prepare_view('node', $nodes, $view_mode, $langcode);
entity_prepare_view('node', $nodes, $langcode);
$build = array();
$entities_by_view_mode = entity_view_mode_prepare('node', $nodes, $view_mode, $langcode);
foreach ($entities_by_view_mode as $entity_view_mode => $entities) {
field_attach_prepare_view('node', $entities, $entity_view_mode, $langcode);
entity_prepare_view('node', $entities, $langcode);
foreach ($entities as $entity) {
$build['nodes'][$entity->nid] = node_view($entity, $entity_view_mode, $langcode);
}
}
foreach ($nodes as $node) {
$build['nodes'][$node->nid] = node_view($node, $view_mode, $langcode);
$build['nodes'][$node->nid]['#weight'] = $weight;
$weight++;
}
// Sort here, to preserve the input order of the entities that were passed to
// this function.
uasort($build['nodes'], 'element_sort');
$build['nodes']['#sorted'] = TRUE;
return $build;
}
@@ -3629,7 +3633,8 @@ function node_access_rebuild($batch_mode = FALSE) {
// Try to allocate enough time to rebuild node grants
drupal_set_time_limit(240);
$nids = db_query("SELECT nid FROM {node}")->fetchCol();
// Rebuild newest nodes first so that recent content becomes available quickly.
$nids = db_query("SELECT nid FROM {node} ORDER BY nid DESC")->fetchCol();
foreach ($nids as $nid) {
$node = node_load($nid, NULL, TRUE);
// To preserve database integrity, only acquire grants if the node

View File

@@ -371,35 +371,38 @@ function node_form_build_preview($form, &$form_state) {
* @see node_form_build_preview()
*/
function node_preview($node) {
if (node_access('create', $node) || node_access('update', $node)) {
_field_invoke_multiple('load', 'node', array($node->nid => $node));
// Clone the node before previewing it to prevent the node itself from being
// modified.
$cloned_node = clone $node;
if (node_access('create', $cloned_node) || node_access('update', $cloned_node)) {
_field_invoke_multiple('load', 'node', array($cloned_node->nid => $cloned_node));
// Load the user's name when needed.
if (isset($node->name)) {
if (isset($cloned_node->name)) {
// The use of isset() is mandatory in the context of user IDs, because
// user ID 0 denotes the anonymous user.
if ($user = user_load_by_name($node->name)) {
$node->uid = $user->uid;
$node->picture = $user->picture;
if ($user = user_load_by_name($cloned_node->name)) {
$cloned_node->uid = $user->uid;
$cloned_node->picture = $user->picture;
}
else {
$node->uid = 0; // anonymous user
$cloned_node->uid = 0; // anonymous user
}
}
elseif ($node->uid) {
$user = user_load($node->uid);
$node->name = $user->name;
$node->picture = $user->picture;
elseif ($cloned_node->uid) {
$user = user_load($cloned_node->uid);
$cloned_node->name = $user->name;
$cloned_node->picture = $user->picture;
}
$node->changed = REQUEST_TIME;
$nodes = array($node->nid => $node);
$cloned_node->changed = REQUEST_TIME;
$nodes = array($cloned_node->nid => $cloned_node);
field_attach_prepare_view('node', $nodes, 'full');
// Display a preview of the node.
if (!form_get_errors()) {
$node->in_preview = TRUE;
$output = theme('node_preview', array('node' => $node));
unset($node->in_preview);
$cloned_node->in_preview = TRUE;
$output = theme('node_preview', array('node' => $cloned_node));
unset($cloned_node->in_preview);
}
drupal_set_title(t('Preview'), PASS_THROUGH);

View File

@@ -2782,8 +2782,8 @@ class NodeEntityViewModeAlterTest extends NodeWebTestCase {
$edit = array();
$langcode = LANGUAGE_NONE;
$edit["title"] = $this->randomName(8);
$edit["body[$langcode][0][value]"] = t('Data that should appear only in the body for the node.');
$edit["body[$langcode][0][summary]"] = t('Extra data that should appear only in the teaser for the node.');
$edit["body[$langcode][0][value]"] = 'Data that should appear only in the body for the node.';
$edit["body[$langcode][0][summary]"] = 'Extra data that should appear only in the teaser for the node.';
$this->drupalPost('node/add/page', $edit, t('Save'));
$node = $this->drupalGetNodeByTitle($edit["title"]);
@@ -2801,6 +2801,45 @@ class NodeEntityViewModeAlterTest extends NodeWebTestCase {
$build = node_view($node);
$this->assertEqual($build['#view_mode'], 'teaser', 'The view mode has correctly been set to teaser.');
}
/**
* Tests fields that were previously hidden when the view mode is changed.
*/
function testNodeViewModeChangeHiddenField() {
// Hide the tags field on the default display
$instance = field_info_instance('node', 'field_tags', 'article');
$instance['display']['default']['type'] = 'hidden';
field_update_instance($instance);
$web_user = $this->drupalCreateUser(array('create article content', 'edit own article content'));
$this->drupalLogin($web_user);
// Create a node.
$edit = array();
$langcode = LANGUAGE_NONE;
$edit["title"] = $this->randomName(8);
$edit["body[$langcode][0][value]"] = 'Data that should appear only in the body for the node.';
$edit["body[$langcode][0][summary]"] = 'Extra data that should appear only in the teaser for the node.';
$edit["field_tags[$langcode]"] = 'Extra tag';
$this->drupalPost('node/add/article', $edit, t('Save'));
$node = $this->drupalGetNodeByTitle($edit["title"]);
// Set the flag to alter the view mode and view the node.
variable_set('node_test_change_view_mode', 'teaser');
$this->drupalGet('node/' . $node->nid);
// Check that teaser mode is viewed.
$this->assertText('Extra data that should appear only in the teaser for the node.', 'Teaser text present');
// Make sure body text is not present.
$this->assertNoText('Data that should appear only in the body for the node.', 'Body text not present');
// Make sure tags are present.
$this->assertText('Extra tag', 'Taxonomy term present');
// Test that the correct build mode has been set.
$build = node_view($node);
$this->assertEqual($build['#view_mode'], 'teaser', 'The view mode has correctly been set to teaser.');
}
}
/**

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -211,7 +211,7 @@ function node_access_test_node_insert($node) {
}
/**
* Implements hook_nodeapi_update().
* Implements hook_node_update().
*/
function node_access_test_node_update($node) {
_node_access_test_node_write($node);

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"

View File

@@ -5,8 +5,8 @@ version = VERSION
core = 7.x
hidden = TRUE
; Information added by Drupal.org packaging script on 2014-05-08
version = "7.28"
; Information added by Drupal.org packaging script on 2015-04-02
version = "7.36"
project = "drupal"
datestamp = "1399522731"
datestamp = "1427943826"