updated core to 7.73

This commit is contained in:
2020-09-24 17:04:08 +02:00
parent 084d28842a
commit 7d87153100
524 changed files with 25194 additions and 7745 deletions
+80 -45
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.
@@ -948,7 +950,7 @@ function hook_node_info() {
* 'recent', or 'comments'. The values should be arrays themselves, with the
* following keys available:
* - title: (required) The human readable name of the ranking mechanism.
* - join: (optional) The part of a query string to join to any additional
* - join: (optional) An array with information to join any additional
* necessary table. This is not necessary if the table required is already
* joined to by the base query, such as for the {node} table. Other tables
* should use the full table name as an alias to avoid naming collisions.
@@ -972,7 +974,12 @@ function hook_ranking() {
'title' => t('Average vote'),
// Note that we use i.sid, the search index's search item id, rather than
// n.nid.
'join' => 'LEFT JOIN {vote_node_data} vote_node_data ON vote_node_data.nid = i.sid',
'join' => array(
'type' => 'LEFT',
'table' => 'vote_node_data',
'alias' => 'vote_node_data',
'on' => 'vote_node_data.nid = i.sid',
),
// The highest possible score should be 1, and the lowest possible score,
// always 0, should be 0.
'score' => 'vote_node_data.average / CAST(%f AS DECIMAL)',
@@ -1030,12 +1037,23 @@ 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.
*
* This hook is invoked from node_delete_multiple() after the node has been
* removed from the node table in the database, before hook_node_delete() is
* invoked, and before field_attach_delete() is called.
* 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.
*
* Note that when this hook is invoked, the changes have not yet been written
* to the database, because a database transaction is still in progress. The
* transaction is not finalized until the delete operation is entirely
* completed and node_delete_multiple() goes out of scope. You should not rely
* on data in the database at this time as it is not updated yet. You should
* also note that any write/update database queries executed from this hook are
* also not committed immediately. Check node_delete_multiple() and
* db_transaction() for more info.
*
* @param $node
* The node that is being deleted.
@@ -1051,8 +1069,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.
@@ -1063,26 +1084,21 @@ function hook_delete($node) {
* @ingroup node_api_hooks
*/
function hook_prepare($node) {
if ($file = file_check_upload($field_name)) {
$file = file_save_upload($field_name, _image_filename($file->filename, NULL, TRUE));
if ($file) {
if (!image_get_info($file->uri)) {
form_set_error($field_name, t('Uploaded file is not a valid image'));
return;
}
}
else {
return;
}
$node->images['_original'] = $file->uri;
_image_build_derivatives($node, TRUE);
$node->new_file = TRUE;
if (!isset($node->mymodule_value)) {
$node->mymodule_value = 'foo';
}
}
/**
* 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.
@@ -1138,8 +1154,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
@@ -1162,8 +1181,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
@@ -1196,8 +1218,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
@@ -1218,8 +1243,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
@@ -1252,8 +1280,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
@@ -1263,6 +1294,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
@@ -1276,7 +1311,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);