You are here

function custom_pub_off_action in Custom Publishing Options 6

Same name and namespace in other branches
  1. 7 custom_pub.module \custom_pub_off_action()

Implements a configurable action.

Toggles a custom publishing option off 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 532
Adds the ability to add Custom publishing options to the node Add/Edit form.

Code

function custom_pub_off_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 (in_array($node->type, array_keys($types[$type]['node_types']))) {
      $node->{$type} = 0;
      watchdog('action', 'Toggled @type %title custom publishing option: @label to off.', array(
        '@type' => node_get_types('name', $node),
        '%title' => $node->title,
        '@label' => $types[$type]['name'],
      ));
    }
  }
  return array(
    'node' => $node,
  );
}