function _content_lock_is_lockable_node in Content locking (anti-concurrent editing) 6
Same name and namespace in other branches
- 6.2 content_lock.module \_content_lock_is_lockable_node()
- 7 content_lock.module \_content_lock_is_lockable_node()
- 7.2 content_lock.module \_content_lock_is_lockable_node()
Check whether a node is configured to be protected by content_lock.
2 calls to _content_lock_is_lockable_node()
- content_lock_content_lock_skip_locking in ./
content_lock.module - content_lock_nodeapi in ./
content_lock.module - Implementation of hook_nodeapi().
File
- ./
content_lock.module, line 600 - Allows users to lock documents for modification.
Code
function _content_lock_is_lockable_node($node) {
static $lockable;
// To catch the case where the user is changing the input format,
// we store the original input format.
$format = $node->format;
if (!empty($node->content_lock_old_format)) {
$format = $node->content_lock_old_format;
}
// Check for a cache hit
if (isset($lockable[$format][$node->nid])) {
return $lockable[$format][$node->nid];
}
$types = array_filter(variable_get('content_lock_allowed_node_types', array()));
// Let other modules modify our blacklist
drupal_alter('content_lock_node_type_blacklist', $types, $node);
$formats = array_filter(variable_get('content_lock_allowed_formats', array()));
$lockable[$format][$node->nid] = FALSE;
// Determine if the node is of a lockable content type or text format.
if ((empty($types) || in_array($node->type, $types)) && (empty($formats) || in_array($format, $formats))) {
$lockable[$format][$node->nid] = TRUE;
}
return $lockable[$format][$node->nid];
}