Projet

Général

Profil

Paste
Télécharger (792 octets) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / feeds / tests / feeds_tests.rules.inc @ ed9a13f1

1
<?php
2

    
3
/**
4
 * @file
5
 * Includes any rules integration provided by the module.
6
 */
7

    
8
/**
9
 * Implements hook_rules_event_info().
10
 */
11
function feeds_tests_rules_event_info() {
12
  return array(
13
    'feeds_tests_rules_event' => array(
14
      'label' => t('Test event'),
15
      'group' => t('Feeds'),
16
    ),
17
  );
18
}
19

    
20
/**
21
 * Implements hook_rules_action_info().
22
 */
23
function feeds_tests_rules_action_info() {
24
  $items['feeds_tests_create_node'] = array(
25
    'label' => t('Create a node'),
26
    'group' => t('Rules test'),
27
  );
28
  return $items;
29
}
30

    
31
/**
32
 * Rules action callback: creates a node.
33
 */
34
function feeds_tests_create_node() {
35
  $node = new stdClass();
36
  $node->title = 'Test node';
37
  $node->type = 'page';
38
  $node->status = 1;
39
  $node->uid = 0;
40
  node_object_prepare($node);
41
  node_save($node);
42
}