Skip to content

Commit

Permalink
feat(clone): Reset node options by default
Browse files Browse the repository at this point in the history
  • Loading branch information
torotil committed Jul 18, 2024
1 parent 402bbe5 commit 4fa43e4
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,14 @@ function campaignion_manage_clone_clone_node_alter($node, $context) {
}
}
}
// Reset some node flags to their defaults.
// This is copied from _clone_node_prepare but it resets by default.
if (variable_get('clone_reset_' . $node->type, TRUE)) {
$node_options = variable_get('node_options_' . $node->type, array('status', 'promote'));
// Fill in the default values.
foreach (array('status', 'moderate', 'promote', 'sticky', 'revision') as $key) {
// Cast to int since that's how they need to be saved to the DB.
$node->$key = (int) in_array($key, $node_options);
}
}
}

0 comments on commit 4fa43e4

Please sign in to comment.