Loading custom_pub.module +5 −13 Original line number Diff line number Diff line Loading @@ -227,21 +227,15 @@ function custom_pub_action_info() { 'description' => t('Toggle a Custom Publishing Option on'), 'configurable' => TRUE, 'behavior' => array('changes_node_property'), 'hooks' => array( 'nodeapi' => array('presave'), 'comment' => array('insert', 'update'), ), 'triggers' => array('node_presave', 'comment_insert', 'comment_update'), ); $actions['custom_pub_off_action'] = array( 'label' => 'Toggle a Custom Publishing Option off', 'type' => 'node', 'description' => t('Toggle a Custom Publishing Option off'), 'configurable' => TRUE, 'behavior' => array('changes_node_property'), 'hooks' => array( 'nodeapi' => array('presave'), 'comment' => array('delete', 'insert', 'update'), ), 'behavior' => array('changes_property'), 'triggers' => array('node_presave', 'comment_insert', 'comment_update'), ); return $actions; Loading @@ -259,13 +253,12 @@ function custom_pub_action_info() { * The available context of the current action. */ 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 // This is mainly for the Rules Module. $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; node_save($node); watchdog('action', 'Toggled @type %title custom publishing option: @label to on.', array('@type' => node_type_get_types('name', $node), '%title' => $node->title, '@label' => $types[$type]['name'])); } } Loading Loading @@ -317,13 +310,12 @@ function custom_pub_on_action_submit($form, &$form_state) { * @return array */ 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 // This is mainly for the Rules Module. $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; node_save($node); watchdog('action', 'Toggled @type %title custom publishing option: @label to off.', array('@type' => node_type_get_types('name', $node), '%title' => $node->title, '@label' => $types[$type]['name'])); } } Loading Loading
custom_pub.module +5 −13 Original line number Diff line number Diff line Loading @@ -227,21 +227,15 @@ function custom_pub_action_info() { 'description' => t('Toggle a Custom Publishing Option on'), 'configurable' => TRUE, 'behavior' => array('changes_node_property'), 'hooks' => array( 'nodeapi' => array('presave'), 'comment' => array('insert', 'update'), ), 'triggers' => array('node_presave', 'comment_insert', 'comment_update'), ); $actions['custom_pub_off_action'] = array( 'label' => 'Toggle a Custom Publishing Option off', 'type' => 'node', 'description' => t('Toggle a Custom Publishing Option off'), 'configurable' => TRUE, 'behavior' => array('changes_node_property'), 'hooks' => array( 'nodeapi' => array('presave'), 'comment' => array('delete', 'insert', 'update'), ), 'behavior' => array('changes_property'), 'triggers' => array('node_presave', 'comment_insert', 'comment_update'), ); return $actions; Loading @@ -259,13 +253,12 @@ function custom_pub_action_info() { * The available context of the current action. */ 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 // This is mainly for the Rules Module. $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; node_save($node); watchdog('action', 'Toggled @type %title custom publishing option: @label to on.', array('@type' => node_type_get_types('name', $node), '%title' => $node->title, '@label' => $types[$type]['name'])); } } Loading Loading @@ -317,13 +310,12 @@ function custom_pub_on_action_submit($form, &$form_state) { * @return array */ 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 // This is mainly for the Rules Module. $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; node_save($node); watchdog('action', 'Toggled @type %title custom publishing option: @label to off.', array('@type' => node_type_get_types('name', $node), '%title' => $node->title, '@label' => $types[$type]['name'])); } } Loading