Commit 1d40ae0e authored by Jeremy Meier's avatar Jeremy Meier Committed by Vladimir Roudakov
Browse files

Issue #2074757 by ajm8372, dbazuin, VladimirAus: hook_action_info() seems to be using D6 API

parent 4c885116
Loading
Loading
Loading
Loading
+5 −13
Original line number Diff line number Diff line
@@ -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;
@@ -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']));
    }
  }
@@ -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']));
    }
  }