function custom_pub_on_action in Custom Publishing Options 6
Same name and namespace in other branches
- 7 custom_pub.module \custom_pub_on_action()
Implements a configurable action.
Toggles a custom publishing option on as an action.
Parameters
$node: The node object of the current node.
$context: The available context of the current action.
File
- ./
custom_pub.module, line 481 - Adds the ability to add Custom publishing options to the node Add/Edit form.
Code
function custom_pub_on_action(&$node, &$context) {
//This is mainly for the Rules Module. I couldn't get a node to save unless I set this manually
$context['auto_save'] = TRUE;
$types = variable_get('custom_pub_types', array());
foreach ($context['types'] as $type) {
if (!empty($type) && in_array($node->type, array_keys($types[$type]['node_types']))) {
$node->{$type} = 1;
watchdog('action', 'Toggled @type %title custom publishing option: @label to on.', array(
'@type' => node_get_types('name', $node),
'%title' => $node->title,
'@label' => $types[$type]['name'],
));
}
}
}