function content_lock_fetch_lock in Content locking (anti-concurrent editing) 7.3
Same name and namespace in other branches
- 6.2 content_lock.module \content_lock_fetch_lock()
- 6 content_lock.module \content_lock_fetch_lock()
- 7 content_lock.module \content_lock_fetch_lock()
- 7.2 content_lock.module \content_lock_fetch_lock()
Fetch the lock for a node.
Parameters
string $nid: A node id.
Return value
object The lock for the node. FALSE, if the document is not locked.
7 calls to content_lock_fetch_lock()
- content_lock_js in ./
content_lock.module - Load module javascript.
- content_lock_locking in ./
content_lock.module - Try to lock a document for editing.
- content_lock_node_lock_ctools_access_check in plugins/
access/ node_lock.inc - Checks if the node is locked.
- content_lock_node_validate in ./
content_lock.module - Implements hook_node_validate().
- content_lock_release_item in includes/
content_lock.pages.inc - Menu callback.
File
- ./
content_lock.module, line 335
Code
function content_lock_fetch_lock($entity_id, $entity_type = 'node') {
$query = db_select('content_lock', 'c')
->fields('c')
->condition('c.entity_type', $entity_type)
->condition('c.entity_id', $entity_id);
$u = $query
->leftJoin('users', 'u', '%alias.uid = c.uid');
$query
->fields($u, array(
'name',
));
return $query
->execute()
->fetchObject();
}