You are here

nodehierarchy_workflow_ng.inc in Node Hierarchy 6.3

Same filename and directory in other branches
  1. 6.2 includes/nodehierarchy_workflow_ng.inc

Some workflow-ng conditions/actions

File

includes/nodehierarchy_workflow_ng.inc
View source
<?php

/**
 * @file
 * Some workflow-ng conditions/actions
 */

/**
 * Implementation of hook_condition_info()
 */
function nodehierarchy_condition_info() {
  return array(
    'nodehierarchy_has_parent' => array(
      '#label' => t('Content has parent'),
      '#arguments' => array(
        'node' => array(
          '#entity' => 'node',
          '#label' => t('Content'),
        ),
      ),
      '#module' => t('Node Hierarchy'),
    ),
  );
}
function nodehierarchy_has_parent($node, $settings) {
  return (bool) nodehierarchy_get_node_parent_nids($node->nid);
}

/**
 * Implementation of hook_action_info()
 */
function nodehierarchy_action_info() {
  return array(
    'nodehierarchy_action_load' => array(
      '#label' => t('Load a content\'s parent content'),
      '#arguments' => array(
        'node' => array(
          '#entity' => 'node',
          '#label' => t('Child content'),
        ),
      ),
      '#new arguments' => array(
        'node_parent' => array(
          '#entity' => 'node',
          '#label' => t('Parent content'),
        ),
      ),
      '#module' => t('Node Hierarchy'),
    ),
  );
}

/**
 * Loads the node's parent.
 */
function nodehierarchy_action_load($node, $settings) {
  $parents = nodehierarchy_get_node_parent_nids($nid);
  if ($parent = node_load($pnid)) {
    return array(
      '#new arguments' => array(
        'node_parent' => $parent,
      ),
    );
  }
}

Functions

Namesort descending Description
nodehierarchy_action_info Implementation of hook_action_info()
nodehierarchy_action_load Loads the node's parent.
nodehierarchy_condition_info Implementation of hook_condition_info()
nodehierarchy_has_parent