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

Drupal example source code file (rules_test.module)

This example Drupal source code file (rules_test.module) 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

_rules_exec_log, _rules_log, _rules_show_log, array, error, function, global, if, is_array, isset, msg, php, return, variable

The rules_test.module Drupal example source code

<?php
// $Id: rules_test.module,v 1.1.2.4 2009/04/19 15:03:43 fago Exp $


/**
 * @file Rules engine testing module
 */

/**
 * Returns the log and clears it afterwards
 */
function rules_test_show_log(&$error) {
  global $_rules_log;

  if (is_array($_rules_log) && count($_rules_log)) {
    $i = 0;
    $msg = _rules_show_log($i, $_rules_log, $error);
    $_rules_log = NULL;

    return $msg;
  }
  return FALSE;
}

/**
 * Makes sure the rules engine doesn't clean up the log, so that we can access it
 */
function rules_test_keep_rules_log() {
  global $_rules_exec_log;

  if (!isset($_rules_exec_log)) {
    $_rules_exec_log = array();
  }
  $_rules_exec_log['rules_test_keep_log'] = 'rules_test_keep_log';
}

/**
 * Cleans up
 */
function rules_test_done() {
  global $_rules_exec_log;

  if (isset($_rules_exec_log)) {
    unset($_rules_exec_log['rules_test_keep_log']);
  }
}

Other Drupal examples (source code examples)

Here is a short list of links related to this Drupal rules_test.module 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.