Skip to content

Commit

Permalink
Merge pull request #10 from jenlampton/9-array-fatal
Browse files Browse the repository at this point in the history
Issue #9: Harden against accidental fatals.
  • Loading branch information
robertgarrigos authored Dec 27, 2024
2 parents 2048a51 + c6e2583 commit e272419
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions content_lock.module
Original file line number Diff line number Diff line change
Expand Up @@ -1149,11 +1149,15 @@ function content_lock_content_lock_node_lockable($node) {
return $lockable[$format][$node->nid];
}

$types = array_filter($config->get('content_lock_allowed_node_types'));
// Let other modules modify our blacklist.
backdrop_alter('content_lock_node_type_blacklist', $types, $node);
$formats = array_filter($config->get('content_lock_allowed_formats'));
$lockable[$format][$node->nid] = FALSE;
$saved_types = $config->get('content_lock_allowed_node_types');
if (!empty($saved_types)) {
$types = array_filter($saved_types);
// Let other modules modify our blacklist.
backdrop_alter('content_lock_node_type_blacklist', $types, $node);
$formats = array_filter($config->get('content_lock_allowed_formats'));
$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))
Expand Down

0 comments on commit e272419

Please sign in to comment.