You are here

function content_lock_is_lockable in Content locking (anti-concurrent editing) 7.3

Check whether a node is configured to be protected by content_lock.

4 calls to content_lock_is_lockable()
content_lock_content_lock_skip_locking in ./content_lock.module
Implements our own skip_locking api to implement our logic to skip locks.
content_lock_node_update in ./content_lock.module
Implements hook_node_update().
content_lock_node_validate in ./content_lock.module
Implements hook_node_validate().
content_lock_node_view in ./content_lock.module
Implements hook_node_view().

File

./content_lock.module, line 461

Code

function content_lock_is_lockable($entity, $entity_type = 'node') {
  list($entity_id, , $bundle) = entity_extract_ids($entity_type, $entity);

  // Only call hooks while a valid entity with entity id.
  if ($entity_id) {
    if ($entity_type == 'node') {

      // Respect legacy hook.
      return !in_array(FALSE, module_invoke_all('content_lock_node_lockable', $entity));
    }
    else {
      return !in_array(FALSE, module_invoke_all('content_lock_entity_lockable', $entity, $entity_id, $entity_type, $bundle));
    }
  }

  // Always return FALSE.
  return FALSE;
}