-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathviews_bulk_operations.rules.inc
85 lines (72 loc) · 2.83 KB
/
views_bulk_operations.rules.inc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
/**
* Implementation of hook_rules_action_info().
*/
function views_bulk_operations_rules_action_info() {
$actions = array();
// Execute VBO programmatically.
foreach (module_invoke_all('views_bulk_operations_object_info') as $type => $info) {
$actions['views_bulk_operations_rules_action_' . $type] = array(
'label' => t('Use !type object to execute a VBO programmatically', array('!type' => $type)),
'arguments' => array(
'object' => array(
'type' => $type,
'label' => t('Object'),
'description' => t('The chosen object will be loaded as the <code>$object</code> variable, available below.'),
),
),
'module' => 'Views Bulk Operations',
'eval input' => array(),
'base' => 'views_bulk_operations_rules_action',
);
}
// Modify node fields.
$actions['views_bulk_operations_fields_rules_action'] = array(
'label' => t('Modify node fields'),
'arguments' => array(
'node' => array(
'type' => 'node',
'label' => t('Node'),
),
),
'module' => 'Node',
);
return $actions;
}
function _views_bulk_operations_rules_variables(&$context, $state) {
if (!empty($state['variables'])) foreach ($state['variables'] as $variable) {
if (!empty($variable->data)) {
$context['rules'][$variable->name] = $variable->data->_data;
}
}
}
function views_bulk_operations_rules_action($object, $settings, $element, &$state) {
_views_bulk_operations_rules_variables($settings, $state);
views_bulk_operations_action($object, $settings);
return array('object' => $object);
}
function views_bulk_operations_rules_action_form($settings, &$form, &$form_state) {
$form += views_bulk_operations_action_form($settings);
}
function views_bulk_operations_rules_action_validate($form, &$form_state) {
views_bulk_operations_action_validate($form, $form_state);
}
function views_bulk_operations_rules_action_submit(&$settings, $form, &$form_state) {
$submit = views_bulk_operations_action_submit($form, $form_state);
$settings = array_merge($settings, $submit);
}
function views_bulk_operations_fields_rules_action($object, $settings, $element, &$state) {
_views_bulk_operations_rules_variables($settings, $state);
views_bulk_operations_fields_action($object, $settings);
return array('node' => $object);
}
function views_bulk_operations_fields_rules_action_form($settings, &$form, &$form_state) {
$form += views_bulk_operations_fields_action_form($settings);
}
function views_bulk_operations_fields_rules_action_validate($form, &$form_state) {
views_bulk_operations_fields_action_validate($form, $form_state);
}
function views_bulk_operations_fields_rules_action_submit(&$settings, $form, &$form_state) {
$submit = views_bulk_operations_fields_action_submit($form, $form_state);
$settings = array_merge($settings, $submit);
}