home | career | drupal | java | mac | mysql | perl | php | scala | uml | unix

Drupal example source code file (rules_test.rules.inc)

This example Drupal source code file (rules_test.rules.inc) is included in the DevDaily.com "Drupal Source Code Warehouse" project. The intent of this project is to help you "Learn Drupal by Example".

PHP - Drupal tags/keywords

arguments, array, data, function, hidden, label, new, php, return, rules_test, rules_test_action_log_msg, rules_test_condition_check_for_altered_arg, test, true

The rules_test.rules.inc Drupal example source code

<?php
// $Id: rules_test.rules.inc,v 1.1.2.6 2009/04/19 15:03:43 fago Exp $


/**
 * @file Define some conditions and actions, used by the tests
 */

/**
 * Implementation of hook_rules_condition_info
 */
function rules_test_rules_condition_info() {
  return array(
    'rules_test_condition_alter_arg' => array(
      'label' => 'Alter data',
      'arguments' => array('rules_test' => array('type' => 'rules_test', 'label' => 'test')),
      'hidden' => TRUE,
    ),
    'rules_test_condition_check_for_altered_arg' => array(
      'label' => 'Check for altered data',
      'arguments' => array('rules_test' => array('type' => 'rules_test', 'label' => 'test')),
      'hidden' => TRUE,
    ),
  );
}

/**
 * Implementation of hook_rules_action_info
 */
function rules_test_rules_action_info() {
  return array(
    'rules_test_action_log_msg' => array(
      'label' => 'Logs a message to the rules log',
      'arguments' => array(),
      'hidden' => TRUE,
    ),
    'rules_test_change_arg' => array(
      'label' => 'Changes the argument',
      'arguments' => array('rules_test' => array('type' => 'rules_test', 'label' => 'test')),
      'hidden' => TRUE,
    ),
    'rules_test_add_var' => array(
      'label' => 'Adds a new variable',
      'new variables' => array('rules_test' => array('type' => 'rules_test', 'label' => 'test')),
      'hidden' => TRUE,
    ),
  );
}

function rules_test_condition_alter_arg(&$array) {
  $array['altered'] = TRUE;
  return TRUE;
}

function rules_test_condition_check_for_altered_arg($array) {
  return isset($array['altered']) && $array['altered'];
}

function rules_test_action_log_msg($settings) {
  rules_log($settings['msg']);
}

function rules_test_change_arg($array) {
  $array['altered'] = TRUE;
  return array('rules_test' => $array);
}

function rules_test_add_var() {
  $array['altered'] = FALSE;
  return array('rules_test' => $array);
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal rules_test.rules.inc source code file:

new blog posts

"Drupal" is a registered trademark of Dries Buytaert.

my drupal tutorials and examples  

Copyright 1998-2016 Alvin Alexander, alvinalexander.com
All Rights Reserved.

Beginning in 2016, a portion of the proceeds from pages under the '/drupal-code-examples/' URI will be donated to charity.