|
|
Drupal example source code file (rules_test.test.inc)
The rules_test.test.inc Drupal example source code<?php // $Id: rules_test.test.inc,v 1.1.2.3 2011/02/16 17:22:34 fago Exp $ /** * @file Include file for testing file inclusion. */ /** * Extender for the node data type. */ function rules_test_custom_node_save($object) { throw new RulesException('Custom save method invoked.'); } /** * Custom help callback for the rules_node_publish_action */ function rules_test_custom_help() { return 'custom'; } /** * Action callback */ function rules_action_test_reference($data) { $data['changed'] = TRUE; return array('arg' => $data); } /** * Condition: Check for selected content types */ function rules_condition_content_is_type($node, $type) { return in_array($node->type, $type); } /** * Condition: Check if the node is published */ function rules_condition_content_is_published($node, $settings) { return $node->status == 1; } /** * Loads a node */ function rules_action_load_node($nid, $vid = NULL) { return array('node_loaded' => node_load($nid, $vid ? $vid : NULL)); } /** * Action "Delete a node". */ function rules_action_delete_node($node) { node_delete($node->nid); } /** * An action making use of named parameters. */ function rules_action_node_set_title($arguments) { // Make sure the data is unwrapped. if ($arguments['node'] instanceof EntityMetadataWrapper) { throw new Exception('Argument has not been correctly unwrapped.'); } $arguments['node']->title = $arguments['title']; return $arguments; } /** * Action: Test saving - nothing to do here. */ function rules_test_type_save($node) { } Other Drupal examples (source code examples)Here is a short list of links related to this Drupal rules_test.test.inc source code file: |
"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.