You are here

nodehierarchy_workflow_ng.inc in Node Hierarchy 5

Same filename and directory in other branches
  1. 6 nodehierarchy_workflow_ng.inc

Some workflow-ng conditions/actions.

File

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) $node->parent;
}

/**
 * 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) {
  if ($parent = node_load($node->parent)) {
    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