update to 7.22

Signed-off-by: bachy <git@g-u-i.net>
This commit is contained in:
bachy
2013-05-24 13:03:57 +02:00
parent d5097a4bc6
commit 5658794f17
265 changed files with 5551 additions and 8808 deletions

View File

@@ -141,6 +141,7 @@ function node_theme() {
),
'node_admin_overview' => array(
'variables' => array('name' => NULL, 'type' => NULL),
'file' => 'content_types.inc',
),
'node_recent_block' => array(
'variables' => array('nodes' => NULL),
@@ -200,8 +201,8 @@ function node_entity_info() {
),
);
// Search integration is provided by node.module, so search-related
// view modes for nodes are defined here and not in search.module.
// Search integration is provided by node.module, so search-related view modes
// for nodes are defined here and not in search.module.
if (module_exists('search')) {
$return['node']['view modes'] += array(
'search_index' => array(
@@ -244,6 +245,12 @@ function node_field_display_node_alter(&$display, $context) {
/**
* Entity URI callback.
*
* @param $node
* A node entity.
*
* @return array
* An array with 'path' as the key and the path to the node as its value.
*/
function node_uri($node) {
return array(
@@ -296,7 +303,7 @@ function node_title_list($result, $title = NULL) {
}
/**
* Update the 'last viewed' timestamp of the specified node for current user.
* Updates the 'last viewed' timestamp of the specified node for current user.
*
* @param $node
* A node object.
@@ -315,8 +322,14 @@ function node_tag_new($node) {
}
/**
* Retrieves the timestamp at which the current user last viewed the
* specified node.
* Retrieves the timestamp for the current user's last view of a specified node.
*
* @param $nid
* A node ID.
*
* @return
* If a node has been previously viewed by the user, the timestamp in seconds
* of when the last view occurred; otherwise, zero.
*/
function node_last_viewed($nid) {
global $user;
@@ -330,12 +343,13 @@ function node_last_viewed($nid) {
}
/**
* Decide on the type of marker to be displayed for a given node.
* Determines the type of marker to be displayed for a given node.
*
* @param $nid
* Node ID whose history supplies the "last viewed" timestamp.
* @param $timestamp
* Time which is compared against node's "last viewed" timestamp.
*
* @return
* One of the MARK constants.
*/
@@ -359,7 +373,7 @@ function node_mark($nid, $timestamp) {
}
/**
* Extract the type name.
* Extracts the type name.
*
* @param $node
* Either a string or object, containing the node type information.
@@ -461,6 +475,8 @@ function node_type_get_name($node) {
* node_type_save(), and obsolete ones are deleted via a call to
* node_type_delete(). See _node_types_build() for an explanation of the new
* and obsolete types.
*
* @see _node_types_build()
*/
function node_types_rebuild() {
_node_types_build(TRUE);
@@ -483,11 +499,34 @@ function node_type_load($name) {
/**
* Saves a node type to the database.
*
* @param $info
* The node type to save, as an object.
* @param object $info
* The node type to save; an object with the following properties:
* - type: A string giving the machine name of the node type.
* - name: A string giving the human-readable name of the node type.
* - base: A string that indicates the base string for hook functions. For
* example, 'node_content' is the value used by the UI when creating a new
* node type.
* - description: A string that describes the node type.
* - help: A string giving the help information shown to the user when
* creating a node of this type.
* - 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.
* - 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.
* - has_title: TRUE or FALSE indicating whether this type uses the node title
* field.
* - title_label: A string containing the label for the title.
* - module: A string giving the module defining this type of node.
* - orig_type: A string giving the original machine-readable name of this
* node type. This may be different from the current type name if the
* 'locked' key is FALSE.
*
* @return
* Status flag indicating outcome of the operation.
* @return int
* A status flag indicating the outcome of the operation, either SAVED_NEW or
* SAVED_UPDATED.
*/
function node_type_save($info) {
$existing_type = !empty($info->old_type) ? $info->old_type : $info->type;
@@ -540,7 +579,7 @@ function node_type_save($info) {
}
/**
* Add default body field to a node type.
* Adds default body field to a node type.
*
* @param $type
* A node type object.
@@ -655,6 +694,7 @@ function node_type_update_nodes($old_type, $type) {
*
* @param $rebuild
* TRUE to rebuild node types. Equivalent to calling node_types_rebuild().
*
* @return
* An object with two properties:
* - names: Associative array of the names of node types, keyed by the type.
@@ -761,8 +801,9 @@ function node_type_cache_reset() {
* which prevents users from changing the machine name of the type.
*
* @param $info
* An object or array containing values to override the defaults. See
* hook_node_info() for details on what the array elements mean.
* (optional) An object or array containing values to override the defaults.
* See hook_node_info() for details on what the array elements mean. Defaults
* to an empty array.
*
* @return
* A node type object, with missing values in $info set to their defaults.
@@ -845,12 +886,13 @@ function node_rdf_mapping() {
}
/**
* Determine whether a node hook exists.
* Determines whether a node hook exists.
*
* @param $node
* A node object or a string containing the node type.
* @param $hook
* A string containing the name of the hook.
*
* @return
* TRUE if the $hook exists in the node type of $node.
*/
@@ -860,7 +902,7 @@ function node_hook($node, $hook) {
}
/**
* Invoke a node hook.
* Invokes a node hook.
*
* @param $node
* A node object or a string containing the node type.
@@ -868,6 +910,7 @@ function node_hook($node, $hook) {
* A string containing the name of the hook.
* @param $a2, $a3, $a4
* Arguments to pass on to the hook, after the $node argument.
*
* @return
* The returned value of the invoked hook.
*/
@@ -880,11 +923,11 @@ function node_invoke($node, $hook, $a2 = NULL, $a3 = NULL, $a4 = NULL) {
}
/**
* Load node entities from the database.
* Loads node entities from the database.
*
* This function should be used whenever you need to load more than one node
* from the database. Nodes are loaded into memory and will not require
* database access if loaded again during the same page request.
* from the database. Nodes are loaded into memory and will not require database
* access if loaded again during the same page request.
*
* @see entity_load()
* @see EntityFieldQuery
@@ -910,7 +953,7 @@ function node_load_multiple($nids = array(), $conditions = array(), $reset = FAL
}
/**
* Load a node object from the database.
* Loads a node object from the database.
*
* @param $nid
* The node ID.
@@ -934,6 +977,9 @@ function node_load($nid = NULL, $vid = NULL, $reset = FALSE) {
*
* Fills in a few default values, and then invokes hook_prepare() on the node
* type module, and hook_node_prepare() on all modules.
*
* @param $node
* A node object.
*/
function node_object_prepare($node) {
// Set up default values, if required.
@@ -963,11 +1009,11 @@ function node_object_prepare($node) {
}
/**
* Perform validation checks on the given node.
* Implements hook_validate().
*
* Performs validation checks on the given node.
*/
function node_validate($node, $form, &$form_state) {
$type = node_type_get_type($node);
if (isset($node->nid) && (node_last_changed($node->nid) > $node->changed)) {
form_set_error('changed', t('The content on this page has either been modified by another user, or you have already submitted modifications using this form. As a result, your changes cannot be saved.'));
}
@@ -1000,7 +1046,13 @@ function node_validate($node, $form, &$form_state) {
}
/**
* Prepare node for saving by populating author and creation date.
* Prepares node for saving by populating author and creation date.
*
* @param $node
* A node object.
*
* @return
* An updated node object.
*/
function node_submit($node) {
// A user might assign the node author by entering a user name in the node
@@ -1021,7 +1073,7 @@ function node_submit($node) {
}
/**
* Save changes to a node or add a new node.
* Saves changes to a node or adds a new node.
*
* @param $node
* The $node object to be saved. If $node->nid is
@@ -1159,6 +1211,13 @@ function node_save($node) {
* Helper function to save a revision with the uid of the current user.
*
* The resulting revision ID is available afterward in $node->vid.
*
* @param $node
* A node object.
* @param $uid
* The current user's UID.
* @param $update
* (optional) An array of primary keys' field names to update.
*/
function _node_save_revision($node, $uid, $update = NULL) {
$temp_uid = $node->uid;
@@ -1174,7 +1233,7 @@ function _node_save_revision($node, $uid, $update = NULL) {
}
/**
* Delete a node.
* Deletes a node.
*
* @param $nid
* A node ID.
@@ -1184,7 +1243,7 @@ function node_delete($nid) {
}
/**
* Delete multiple nodes.
* Deletes multiple nodes.
*
* @param $nids
* An array of node IDs.
@@ -1237,7 +1296,7 @@ function node_delete_multiple($nids) {
}
/**
* Delete a node revision.
* Deletes a node revision.
*
* @param $revision_id
* The revision ID to delete.
@@ -1262,7 +1321,7 @@ function node_revision_delete($revision_id) {
}
/**
* Generate an array for rendering the given node.
* Generates an array for rendering the given node.
*
* @param $node
* A node object.
@@ -1367,8 +1426,8 @@ function node_build_content($node, $view_mode = 'full', $langcode = NULL) {
entity_prepare_view('node', array($node->nid => $node), $langcode);
$node->content += field_attach_view('node', $node, $view_mode, $langcode);
// Always display a read more link on teasers because we have no way
// to know when a teaser view is different than a full view.
// Always display a read more link on teasers because we have no way to know
// when a teaser view is different than a full view.
$links = array();
$node->content['links'] = array(
'#theme' => 'links__node',
@@ -1400,12 +1459,13 @@ function node_build_content($node, $view_mode = 'full', $langcode = NULL) {
}
/**
* Generate an array which displays a node detail page.
* Generates an array which displays a node detail page.
*
* @param $node
* A node object.
* @param $message
* A flag which sets a page title relevant to the revision being viewed.
*
* @return
* A $page element suitable for use by drupal_render().
*/
@@ -1428,6 +1488,9 @@ function node_show($node, $message = FALSE) {
*
* @param $node
* A node object.
*
* @return
* The ID of the node if this is a full page view, otherwise FALSE.
*/
function node_is_page($node) {
$page_node = menu_get_object();
@@ -1435,7 +1498,7 @@ function node_is_page($node) {
}
/**
* Process variables for node.tpl.php
* Processes variables for node.tpl.php
*
* Most themes utilize their own copy of node.tpl.php. The default is located
* inside "modules/node/node.tpl.php". Look in there for the full list of
@@ -1557,7 +1620,7 @@ function node_permission() {
}
/**
* Gather the rankings from the the hook_ranking implementations.
* Gathers the rankings from the the hook_ranking() implementations.
*
* @param $query
* A query object that has been extended with the Search DB Extender.
@@ -1804,6 +1867,7 @@ function node_user_delete($account) {
* An associative array containing:
* - form: A render element representing the form.
*
* @see node_search_admin()
* @ingroup themeable
*/
function theme_node_search_admin($variables) {
@@ -1872,11 +1936,11 @@ function _node_revision_access($node, $op = 'view', $account = NULL) {
$node_current_revision = node_load($node->nid);
$is_current_revision = $node_current_revision->vid == $node->vid;
// There should be at least two revisions. If the vid of the given node
// and the vid of the current revision differ, then we already have two
// There should be at least two revisions. If the vid of the given node and
// the vid of the current revision differ, then we already have two
// different revisions so there is no need for a separate database check.
// Also, if you try to revert to or delete the current revision, that's
// not good.
// Also, if you try to revert to or delete the current revision, that's not
// good.
if ($is_current_revision && (db_query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid', array(':nid' => $node->nid))->fetchField() == 1 || $op == 'update' || $op == 'delete')) {
$access[$cid] = FALSE;
}
@@ -1884,8 +1948,8 @@ function _node_revision_access($node, $op = 'view', $account = NULL) {
$access[$cid] = TRUE;
}
else {
// First check the access to the current revision and finally, if the
// node passed in is not the current revision then access to that, too.
// First check the access to the current revision and finally, if the node
// passed in is not the current revision then access to that, too.
$access[$cid] = node_access($op, $node_current_revision, $account) && ($is_current_revision || node_access($op, $node, $account));
}
}
@@ -1893,6 +1957,14 @@ function _node_revision_access($node, $op = 'view', $account = NULL) {
return $access[$cid];
}
/**
* Access callback: Checks whether the user has permission to add a node.
*
* @return
* TRUE if the user has add permission, otherwise FALSE.
*
* @see node_menu()
*/
function _node_add_access() {
$types = node_type_get_types();
foreach ($types as $type) {
@@ -2110,14 +2182,30 @@ function node_menu_local_tasks_alter(&$data, $router_item, $root_path) {
}
/**
* Title callback for a node type.
* Title callback: Returns the unsanitized title of the node type edit form.
*
* @param $type
* The node type object.
*
* @return string
* An unsanitized string that is the title of the node type edit form.
*
* @see node_menu()
*/
function node_type_page_title($type) {
return $type->name;
}
/**
* Title callback.
* Title callback: Returns the title of the node.
*
* @param $node
* The node object.
*
* @return
* An unsanitized string that is the title of the node.
*
* @see node_menu()
*/
function node_page_title($node) {
return $node->title;
@@ -2137,7 +2225,13 @@ function node_last_changed($nid) {
}
/**
* Return a list of all the existing revision numbers.
* Returns a list of all the existing revision numbers.
*
* @param Drupal\node\Node $node
* The node entity.
*
* @return
* An associative array keyed by node revision number.
*/
function node_revision_list($node) {
$revisions = array();
@@ -2223,16 +2317,16 @@ function node_block_save($delta = '', $edit = array()) {
* (optional) The maximum number of nodes to find. Defaults to 10.
*
* @return
* An array of partial node objects or an empty array if there are no recent
* nodes visible to the current user.
* An array of node entities or an empty array if there are no recent nodes
* visible to the current user.
*/
function node_get_recent($number = 10) {
$query = db_select('node', 'n');
if (!user_access('bypass node access')) {
// If the user is able to view their own unpublished nodes, allow them
// to see these in addition to published nodes. Check that they actually
// have some unpublished nodes to view before adding the condition.
// If the user is able to view their own unpublished nodes, allow them to
// see these in addition to published nodes. Check that they actually have
// some unpublished nodes to view before adding the condition.
if (user_access('view own unpublished content') && $own_unpublished = db_query('SELECT nid FROM {node} WHERE uid = :uid AND status = :status', array(':uid' => $GLOBALS['user']->uid, ':status' => NODE_NOT_PUBLISHED))->fetchCol()) {
$query->condition(db_or()
->condition('n.status', NODE_PUBLISHED)
@@ -2362,7 +2456,7 @@ function node_form_block_admin_configure_alter(&$form, &$form_state) {
}
/**
* Form submit handler for block configuration form.
* Form submission handler for node_form_block_admin_configure_alter().
*
* @see node_form_block_admin_configure_alter()
*/
@@ -2394,7 +2488,7 @@ function node_form_block_custom_block_delete_alter(&$form, &$form_state) {
}
/**
* Form submit handler for custom block delete form.
* Form submission handler for node_form_block_custom_block_delete_alter().
*
* @see node_form_block_custom_block_delete_alter()
*/
@@ -2419,8 +2513,8 @@ function node_modules_uninstalled($modules) {
/**
* Implements hook_block_list_alter().
*
* Check the content type specific visibilty settings.
* Remove the block if the visibility conditions are not met.
* Check the content type specific visibilty settings. Remove the block if the
* visibility conditions are not met.
*/
function node_block_list_alter(&$blocks) {
global $theme_key;
@@ -2485,7 +2579,8 @@ function node_block_list_alter(&$blocks) {
* @param $channel
* An associative array containing title, link, description and other keys,
* to be parsed by format_rss_channel() and format_xml_elements().
* A list of channel elements can be found at the @link http://cyber.law.harvard.edu/rss/rss.html RSS 2.0 Specification. @endlink
* A list of channel elements can be found at the
* @link http://cyber.law.harvard.edu/rss/rss.html RSS 2.0 Specification. @endlink
* The link should be an absolute URL.
*/
function node_feed($nids = FALSE, $channel = array()) {
@@ -2505,7 +2600,6 @@ function node_feed($nids = FALSE, $channel = array()) {
$item_length = variable_get('feed_item_length', 'fulltext');
$namespaces = array('xmlns:dc' => 'http://purl.org/dc/elements/1.1/');
$teaser = ($item_length == 'teaser');
// Load all nodes to be rendered.
$nodes = node_load_multiple($nids);
@@ -2559,7 +2653,7 @@ function node_feed($nids = FALSE, $channel = array()) {
}
/**
* Construct a drupal_render() style array from an array of loaded nodes.
* Constructs a drupal_render() style array from an array of loaded nodes.
*
* @param $nodes
* An array of nodes as returned by node_load_multiple().
@@ -2568,8 +2662,8 @@ function node_feed($nids = FALSE, $channel = array()) {
* @param $weight
* An integer representing the weight of the first node in the list.
* @param $langcode
* (optional) A language code to use for rendering. Defaults to the global
* content language of the current request.
* (optional) A language code to use for rendering. Defaults to NULL which is
* the global content language of the current request.
*
* @return
* An array in the format expected by drupal_render().
@@ -2588,7 +2682,12 @@ function node_view_multiple($nodes, $view_mode = 'teaser', $weight = 0, $langcod
}
/**
* Menu callback; Generate a listing of promoted nodes.
* Menu callback: Generates a listing of promoted nodes.
*
* @return array
* An array in the format expected by drupal_render().
*
* @see node_menu()
*/
function node_page_default() {
$select = db_select('node', 'n')
@@ -2638,7 +2737,15 @@ function node_page_default() {
}
/**
* Menu callback; view a single node.
* Menu callback: Displays a single node.
*
* @param $node
* The node object.
*
* @return
* A page array suitable for use by drupal_render().
*
* @see node_menu()
*/
function node_page_view($node) {
// If there is a menu link to this node, the link becomes the last part
@@ -2667,7 +2774,7 @@ function node_update_index() {
}
/**
* Index a single node.
* Indexes a single node.
*
* @param $node
* The node to index.
@@ -2771,7 +2878,7 @@ function node_form_search_form_alter(&$form, $form_state) {
}
/**
* Form API callback for the search form. Registered in node_form_alter().
* Form validation handler for node_form_alter().
*/
function node_search_validate($form, &$form_state) {
// Initialize using any existing basic search keywords.
@@ -2819,8 +2926,8 @@ function node_search_validate($form, &$form_state) {
* @{
* The node access system determines who can do what to which nodes.
*
* In determining access rights for a node, node_access() first checks
* whether the user has the "bypass node access" permission. Such users have
* In determining access rights for a node, node_access() first checks whether
* the user has the "bypass node access" permission. Such users have
* unrestricted access to all nodes. user 1 will always pass this check.
*
* Next, all implementations of hook_node_access() will be called. Each
@@ -2858,8 +2965,7 @@ function node_search_validate($form, &$form_state) {
*/
/**
* Determine whether the current user may perform the given operation on the
* specified node.
* Determines whether the current user may perform the operation on the node.
*
* @param $op
* The operation to be performed on the node. Possible values are:
@@ -2873,6 +2979,7 @@ function node_search_validate($form, &$form_state) {
* @param $account
* Optional, a user object representing the user for whom the operation is to
* be performed. Determines access for a user other than the current user.
*
* @return
* TRUE if the operation may be performed, FALSE otherwise.
*/
@@ -3005,6 +3112,7 @@ function node_node_access($node, $op, $account) {
*
* @param $type
* The machine-readable name of the node type.
*
* @return array
* An array of permission names and descriptions.
*/
@@ -3038,11 +3146,11 @@ function node_list_permissions($type) {
*
* By default, this will include all node types in the system. To exclude a
* specific node from getting permissions defined for it, set the
* node_permissions_$type variable to 0. Core does not provide an interface
* for doing so, however, contrib modules may exclude their own nodes in
* node_permissions_$type variable to 0. Core does not provide an interface for
* doing so. However, contrib modules may exclude their own nodes in
* hook_install(). Alternatively, contrib modules may configure all node types
* at once, or decide to apply some other hook_node_access() implementation
* to some or all node types.
* at once, or decide to apply some other hook_node_access() implementation to
* some or all node types.
*
* @return
* An array of node types managed by this module.
@@ -3061,21 +3169,22 @@ function node_permissions_get_configured_types() {
}
/**
* Fetch an array of permission IDs granted to the given user ID.
* Fetches an array of permission IDs granted to the given user ID.
*
* The implementation here provides only the universal "all" grant. A node
* access module should implement hook_node_grants() to provide a grant
* list for the user.
* access module should implement hook_node_grants() to provide a grant list for
* the user.
*
* After the default grants have been loaded, we allow modules to alter
* the grants array by reference. This hook allows for complex business
* logic to be applied when integrating multiple node access modules.
* After the default grants have been loaded, we allow modules to alter the
* grants array by reference. This hook allows for complex business logic to be
* applied when integrating multiple node access modules.
*
* @param $op
* The operation that the user is trying to perform.
* @param $account
* The user object for the user performing the operation. If omitted, the
* current user is used.
*
* @return
* An associative array in which the keys are realms, and the values are
* arrays of grants for those realms.
@@ -3163,11 +3272,10 @@ function node_access_view_all_nodes($account = NULL) {
/**
* Implements hook_query_TAG_alter().
*
* This is the hook_query_alter() for queries tagged with 'node_access'.
* It adds node access checks for the user account given by the 'account'
* meta-data (or global $user if not provided), for an operation given by
* the 'op' meta-data (or 'view' if not provided; other possible values are
* 'update' and 'delete').
* This is the hook_query_alter() for queries tagged with 'node_access'. It adds
* node access checks for the user account given by the 'account' meta-data (or
* global $user if not provided), for an operation given by the 'op' meta-data
* (or 'view' if not provided; other possible values are 'update' and 'delete').
*/
function node_query_node_access_alter(QueryAlterableInterface $query) {
_node_query_node_access_alter($query, 'node');
@@ -3206,8 +3314,8 @@ function _node_query_node_access_alter($query, $type) {
}
// If $account can bypass node access, or there are no node access modules,
// or the operation is 'view' and the $acount has a global view grant (i.e.,
// a view grant for node ID 0), we don't need to alter the query.
// or the operation is 'view' and the $account has a global view grant
// (such as a view grant for node ID 0), we don't need to alter the query.
if (user_access('bypass node access', $account)) {
return;
}
@@ -3394,15 +3502,14 @@ function node_access_acquire_grants($node, $delete = TRUE) {
*
* If a realm is provided, it will only delete grants from that realm, but it
* will always delete a grant from the 'all' realm. Modules that utilize
* node_access can use this function when doing mass updates due to widespread
* node_access() can use this function when doing mass updates due to widespread
* permission changes.
*
* Note: Don't call this function directly from a contributed module. Call
* node_access_acquire_grants() instead.
*
* @param $node
* The $node being written to. All that is necessary is that it contains a
* nid.
* The node whose grants are being written.
* @param $grants
* A list of grants to write. Each grant is an array that must contain the
* following keys: realm, gid, grant_view, grant_update, grant_delete.
@@ -3410,10 +3517,14 @@ function node_access_acquire_grants($node, $delete = TRUE) {
* is a module-defined id to define grant privileges. each grant_* field
* is a boolean value.
* @param $realm
* If provided, only read/write grants for that realm.
* (optional) If provided, read/write grants for that realm only. Defaults to
* NULL.
* @param $delete
* If false, do not delete records. This is only for optimization purposes,
* and assumes the caller has already performed a mass delete of some form.
* (optional) If false, does not delete records. This is only for optimization
* purposes, and assumes the caller has already performed a mass delete of
* some form. Defaults to TRUE.
*
* @see node_access_acquire_grants()
*/
function node_access_write_grants($node, $grants, $realm = NULL, $delete = TRUE) {
if ($delete) {
@@ -3442,21 +3553,23 @@ function node_access_write_grants($node, $grants, $realm = NULL, $delete = TRUE)
}
/**
* Flag / unflag the node access grants for rebuilding, or read the current
* value of the flag.
* Flags or unflags the node access grants for rebuilding.
*
* If the argument isn't specified, the current value of the flag is returned.
* When the flag is set, a message is displayed to users with 'access
* administration pages' permission, pointing to the 'rebuild' confirm form.
* This can be used as an alternative to direct node_access_rebuild calls,
* allowing administrators to decide when they want to perform the actual
* (possibly time consuming) rebuild.
* When unsure the current user is an administrator, node_access_rebuild
* should be used instead.
* (possibly time consuming) rebuild. When unsure if the current user is an
* administrator, node_access_rebuild() should be used instead.
*
* @param $rebuild
* (Optional) The boolean value to be written.
* @return
* (If no value was provided for $rebuild) The current value of the flag.
*
* @return
* The current value of the flag if no value was provided for $rebuild.
*
* @see node_access_rebuild()
*/
function node_access_needs_rebuild($rebuild = NULL) {
if (!isset($rebuild)) {
@@ -3471,15 +3584,15 @@ function node_access_needs_rebuild($rebuild = NULL) {
}
/**
* Rebuild the node access database. This is occasionally needed by modules
* that make system-wide changes to access levels.
* Rebuilds the node access database.
*
* When the rebuild is required by an admin-triggered action (e.g module
* settings form), calling node_access_needs_rebuild(TRUE) instead of
* This is occasionally needed by modules that make system-wide changes to
* access levels. When the rebuild is required by an admin-triggered action (e.g
* module settings form), calling node_access_needs_rebuild(TRUE) instead of
* node_access_rebuild() lets the user perform his changes and actually
* rebuild only once he is done.
*
* Note : As of Drupal 6, node access modules are not required to (and actually
* Note: As of Drupal 6, node access modules are not required to (and actually
* should not) call node_access_rebuild() in hook_enable/disable anymore.
*
* @see node_access_needs_rebuild()
@@ -3543,11 +3656,14 @@ function node_access_rebuild($batch_mode = FALSE) {
}
/**
* Batch operation for node_access_rebuild_batch.
* Performs batch operation for node_access_rebuild().
*
* This is a multistep operation : we go through all nodes by packs of 20.
* The batch processing engine interrupts processing and sends progress
* feedback after 1 second execution time.
* This is a multistep operation: we go through all nodes by packs of 20. The
* batch processing engine interrupts processing and sends progress feedback
* after 1 second execution time.
*
* @param array $context
* An array of contextual key/value information for rebuild batch process.
*/
function _node_access_rebuild_batch_operation(&$context) {
if (empty($context['sandbox'])) {
@@ -3578,7 +3694,14 @@ function _node_access_rebuild_batch_operation(&$context) {
}
/**
* Post-processing for node_access_rebuild_batch.
* Performs post-processing for node_access_rebuild().
*
* @param bool $success
* A boolean indicating whether the re-build process has completed.
* @param array $results
* An array of results information.
* @param array $operations
* An array of function calls (not used in this function).
*/
function _node_access_rebuild_batch_finished($success, $results, $operations) {
if ($success) {
@@ -3595,7 +3718,6 @@ function _node_access_rebuild_batch_finished($success, $results, $operations) {
* @} End of "defgroup node_access".
*/
/**
* @defgroup node_content Hook implementations for user-created content types
* @{
@@ -3631,6 +3753,7 @@ function node_content_form($node, $form_state) {
/**
* Implements hook_forms().
*
* All node forms share the same form handler.
*/
function node_forms() {
@@ -3715,6 +3838,12 @@ function node_action_info() {
/**
* Sets the status of a node to 1 (published).
*
* @param $node
* A node object.
* @param $context
* (optional) Array of additional information about what triggered the action.
* Not used for this action.
*
* @ingroup actions
*/
function node_publish_action($node, $context = array()) {
@@ -3725,6 +3854,12 @@ function node_publish_action($node, $context = array()) {
/**
* Sets the status of a node to 0 (unpublished).
*
* @param $node
* A node object.
* @param $context
* (optional) Array of additional information about what triggered the action.
* Not used for this action.
*
* @ingroup actions
*/
function node_unpublish_action($node, $context = array()) {
@@ -3735,6 +3870,12 @@ function node_unpublish_action($node, $context = array()) {
/**
* Sets the sticky-at-top-of-list property of a node to 1.
*
* @param $node
* A node object.
* @param $context
* (optional) Array of additional information about what triggered the action.
* Not used for this action.
*
* @ingroup actions
*/
function node_make_sticky_action($node, $context = array()) {
@@ -3745,6 +3886,12 @@ function node_make_sticky_action($node, $context = array()) {
/**
* Sets the sticky-at-top-of-list property of a node to 0.
*
* @param $node
* A node object.
* @param $context
* (optional) Array of additional information about what triggered the action.
* Not used for this action.
*
* @ingroup actions
*/
function node_make_unsticky_action($node, $context = array()) {
@@ -3755,6 +3902,12 @@ function node_make_unsticky_action($node, $context = array()) {
/**
* Sets the promote property of a node to 1.
*
* @param $node
* A node object.
* @param $context
* (optional) Array of additional information about what triggered the action.
* Not used for this action.
*
* @ingroup actions
*/
function node_promote_action($node, $context = array()) {
@@ -3765,6 +3918,12 @@ function node_promote_action($node, $context = array()) {
/**
* Sets the promote property of a node to 0.
*
* @param $node
* A node object.
* @param $context
* (optional) Array of additional information about what triggered the action.
* Not used for this action.
*
* @ingroup actions
*/
function node_unpromote_action($node, $context = array()) {
@@ -3775,6 +3934,9 @@ function node_unpromote_action($node, $context = array()) {
/**
* Saves a node.
*
* @param $node
* The node to be saved.
*
* @ingroup actions
*/
function node_save_action($node) {
@@ -3791,6 +3953,9 @@ function node_save_action($node) {
* Array with the following elements:
* - 'owner_uid': User ID to assign to the node.
*
* @see node_assign_owner_action_form()
* @see node_assign_owner_action_validate()
* @see node_assign_owner_action_submit()
* @ingroup actions
*/
function node_assign_owner_action($node, $context) {
@@ -3801,6 +3966,16 @@ function node_assign_owner_action($node, $context) {
/**
* Generates the settings form for node_assign_owner_action().
*
* @param $context
* Array of additional information about what triggered the action. Includes
* the following elements:
* - 'owner_uid': User ID to assign to the node.
*
* @see node_assign_owner_action_submit()
* @see node_assign_owner_action_validate()
*
* @ingroup forms
*/
function node_assign_owner_action_form($context) {
$description = t('The username of the user to which you would like to assign ownership.');
@@ -3841,6 +4016,8 @@ function node_assign_owner_action_form($context) {
/**
* Validates settings form for node_assign_owner_action().
*
* @see node_assign_owner_action_submit()
*/
function node_assign_owner_action_validate($form, $form_state) {
$exists = (bool) db_query_range('SELECT 1 FROM {users} WHERE name = :name', 0, 1, array(':name' => $form_state['values']['owner_name']))->fetchField();
@@ -3851,6 +4028,8 @@ function node_assign_owner_action_validate($form, $form_state) {
/**
* Saves settings form for node_assign_owner_action().
*
* @see node_assign_owner_action_validate()
*/
function node_assign_owner_action_submit($form, $form_state) {
// Username can change, so we need to store the ID, not the username.
@@ -3860,6 +4039,14 @@ function node_assign_owner_action_submit($form, $form_state) {
/**
* Generates settings form for node_unpublish_by_keyword_action().
*
* @param array $context
* Array of additional information about what triggered this action.
*
* @return array
* A form array.
*
* @see node_unpublish_by_keyword_action_submit()
*/
function node_unpublish_by_keyword_action_form($context) {
$form['keywords'] = array(