function hook_content_lock_skip_locking in Content locking (anti-concurrent editing) 7
Same name and namespace in other branches
- 6.2 content_lock.api.inc \hook_content_lock_skip_locking()
- 7.3 content_lock.api.php \hook_content_lock_skip_locking()
- 7.2 content_lock.api.php \hook_content_lock_skip_locking()
Determine if locking should be disabled for a given node (e.g. by checking its type or other properties).
This hook is called from content_lock_form_alter() before it determines that it is altering a node modification form. Thus, some of this hook's paramesters are the same parameters that would be passed to hook_form_alter().
An implementation of this hook can be used to make the ability to lock a node conditional on an arbitrary aspect of the node.
Parameters
$node: The node for which a lock might be created. This parameter may be NULL in the case that the form is for something other than a node.
$form_id: The form_id for the node's edit form.
$form: The form for the node's edit form.
$form_state: The form_state for the node's edit form.
Return value
FALSE to indicate that locking is allowed or TRUE to prevent this node from being locked.
Related topics
1 function implements hook_content_lock_skip_locking()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
1 invocation of hook_content_lock_skip_locking()
- content_lock_form_alter in ./
content_lock.module - Implementation of hook_form_alter().
File
- ./
content_lock.api.inc, line 46 - Document content_lock hooks.
Code
function hook_content_lock_skip_locking($node, $form_id, $form, $form_state) {
/* Avoid creating warning when $node is NULL */
if (empty($node)) {
return FALSE;
}
/*
* Prevent locking from happening on unpublished nodes since few
* people can access such nodes anyway.
*/
if (!empty($node->status)) {
return TRUE;
}
/* By default allow locking. */
return FALSE;
}