function custom_pub_node_prepare in Custom Publishing Options 7
Implements hook_node_prepare().
1 call to custom_pub_node_prepare()
- custom_pub_entity_presave in ./
custom_pub.module - Implements hook_entity_presave().
File
- ./
custom_pub.module, line 382 - Adds the ability to add Custom publishing options to the node Add/Edit forms.
Code
function custom_pub_node_prepare($node) {
$types = custom_pub_by_node_type($node);
// If this is a new node, fill in the default values.
if (!isset($node->nid)) {
$node_options = variable_get('node_options_' . $node->type, array(
'status',
'promote',
));
foreach (array_keys($types) as $key) {
if (!isset($node->{$key})) {
$node->{$key} = in_array($key, $node_options);
}
}
}
}