You are here

function hook_content_lock_node_lockable in Content locking (anti-concurrent editing) 7

Same name and namespace in other branches
  1. 6.2 content_lock.api.inc \hook_content_lock_node_lockable()
  2. 7.3 content_lock.api.php \hook_content_lock_node_lockable()
  3. 7.2 content_lock.api.php \hook_content_lock_node_lockable()

Determine whether or not a node is lockable.

Called from _content_lock_is_lockable_node() which is in turn called from any code which is conditional upon a node being lockable or not. If this hook returns an affirmative and allows a node to be locked at one point but later on returns a negative on the same node, any existing locks for the node will be ignored. So this hook can control whether or not content_lock is completely disabled for a node (such that even recorded locks for a node can be ignored with this hook).

What this hook does NOT do is prevent someone from editing an un-lockable node. There is not yet a method of doing this without hooking into the node hooks system yourself.

Parameters

$node: The node whose lockability should be checked.

Return value

TRUE if the node should be considered lockable (this should be the default return value) or FALSE if the node may not be considered lockable.

Related topics

1 function implements hook_content_lock_node_lockable()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

content_lock_content_lock_node_lockable in ./content_lock.module
Implement our own hook_content_lock_node_lockable().
1 invocation of hook_content_lock_node_lockable()
_content_lock_is_lockable_node in ./content_lock.module
Check whether a node is configured to be protected by content_lock.

File

./content_lock.api.inc, line 187
Document content_lock hooks.

Code

function hook_content_lock_node_lockable($node) {

  /* Don't bother the superuser with locking */
  if (!$node->status && $node->uid == 1) {
    return FALSE;
  }

  /* By default, let nodes be lockable */
  return TRUE;
}