-
Notifications
You must be signed in to change notification settings - Fork 0
/
ding_social.rules_defaults.inc
138 lines (137 loc) · 5 KB
/
ding_social.rules_defaults.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<?php
/**
* @file
* ding_social.rules_defaults.inc
*
* This file is part of ding_social module.
*
* ding_social module is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
* ding_social module is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with ding_social module. If not, see <https://www.gnu.org/licenses/>.
*/
/**
* Implements hook_default_rules_configuration().
*/
function ding_social_default_rules_configuration() {
$items = array();
$items['rules_fb_check_node_is_flagged'] = entity_import('rules_config', '{ "rules_fb_check_node_is_flagged" : {
"LABEL" : "FB: Check node is flagged",
"PLUGIN" : "and",
"OWNER" : "rules",
"TAGS" : [ "Ding Social" ],
"REQUIRES" : [ "flag" ],
"USES VARIABLES" : { "node" : { "label" : "Node", "type" : "node" } },
"AND" : [
{ "flag_flagged_node" : {
"flag" : "facebook",
"node" : [ "node" ],
"flagging_user" : [ "node:author" ]
}
}
]
}
}');
$items['rules_post_events_to_facebook'] = entity_import('rules_config', '{ "rules_post_events_to_facebook" : {
"LABEL" : "Post Events to Facebook",
"PLUGIN" : "reaction rule",
"ACTIVE" : false,
"OWNER" : "rules",
"TAGS" : [ "Ding Social" ],
"REQUIRES" : [ "rules", "ding_social" ],
"ON" : { "node_insert--ding_event" : { "bundle" : "ding_event" } },
"IF" : [
{ "component_rules_fb_check_node_is_flagged" : { "node" : [ "node" ] } }
],
"DO" : [
{ "entity_create" : {
"USING" : {
"type" : "facebook_publication",
"param_type" : "ding_social_link",
"param_user" : [ "node:author" ]
},
"PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
}
},
{ "data_set" : {
"data" : [ "entity-created:field-facebook-message" ],
"value" : [ "node:field-ding-event-lead" ]
}
},
{ "data_set" : {
"data" : [ "entity-created:field-facebook-link" ],
"value" : [ "node:url" ]
}
},
{ "data_set" : {
"data" : [ "entity-created:field-ding-social-related-id" ],
"value" : [ "node:nid" ]
}
},
{ "scheduled_publish_to_facebook" : {
"USING" : { "publication" : [ "entity-created" ], "pages" : "" },
"PROVIDE" : { "facebook_publication_id" : { "facebook_publication_id" : "Facebook publication returned ID" } }
}
},
{ "data_set" : {
"data" : [ "entity-created:facebook-id" ],
"value" : [ "facebook-publication-id" ]
}
},
{ "entity_save" : { "data" : [ "entity-created" ], "immediate" : 1 } }
]
}
}');
$items['rules_post_news_to_facebook'] = entity_import('rules_config', '{ "rules_post_news_to_facebook" : {
"LABEL" : "Post News to Facebook",
"PLUGIN" : "reaction rule",
"ACTIVE" : false,
"OWNER" : "rules",
"TAGS" : [ "Ding Social" ],
"REQUIRES" : [ "rules", "ding_social" ],
"ON" : { "node_insert--ding_news" : { "bundle" : "ding_news" } },
"IF" : [
{ "component_rules_fb_check_node_is_flagged" : { "node" : [ "node" ] } }
],
"DO" : [
{ "entity_create" : {
"USING" : {
"type" : "facebook_publication",
"param_type" : "ding_social_link",
"param_user" : [ "node:author" ]
},
"PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
}
},
{ "data_set" : {
"data" : [ "entity-created:field-ding-social-related-id" ],
"value" : [ "node:nid" ]
}
},
{ "data_set" : {
"data" : [ "entity-created:field-facebook-message" ],
"value" : [ "node:field-ding-news-lead" ]
}
},
{ "data_set" : {
"data" : [ "entity-created:field-facebook-link" ],
"value" : [ "node:url" ]
}
},
{ "scheduled_publish_to_facebook" : {
"USING" : { "publication" : [ "entity-created" ], "pages" : "" },
"PROVIDE" : { "facebook_publication_id" : { "facebook_publication_id" : "Facebook publication returned ID" } }
}
},
{ "data_set" : {
"data" : [ "entity-created:facebook-id" ],
"value" : [ "facebook-publication-id" ]
}
},
{ "entity_save" : { "data" : [ "entity-created" ], "immediate" : 1 } }
]
}
}');
return $items;
}