function rb_misc_rules_event_info in Rules Bonus Pack 7
Implements hook_rules_event_info().
File
- ./
rb_misc.rules.inc, line 401 - Miscellaneous conditions and actions for Rules.
Code
function rb_misc_rules_event_info() {
// Add events that depend on required modules only.
$events = array();
// Add actions that depend on non-required modules.
if (module_exists('page_manager')) {
// First, and so far only case, optionally provide events for when variants
// in Page manager's custom pages are displayed/executed.
// Loop through all the variants for custom pages defined on the site.
foreach (page_manager_get_tasks_by_type('page') as $task => $task_info) {
foreach (page_manager_load_task_handlers($task_info) as $name => $variant) {
// If the variant is enabled as a Rules trigger, declare a Rules event
// based on the name of the variant and its included context objects.
if (isset($variant->conf['rb_misc_trigger']) && $variant->conf['rb_misc_trigger']) {
$subtask = page_manager_page_subtask($task, $variant->subtask);
_rb_misc_add_variant_render_events($events, $task_info, $subtask, $variant);
}
}
// Some variantes might be exported in hook_default_page_manager_pages().
foreach (page_manager_get_task_subtasks($task_info) as $name => $page) {
$subtask = isset($page['subtask']) ? $page['subtask'] : NULL;
if (isset($subtask->default_handlers)) {
foreach ($subtask->default_handlers as $variant_name => $variant) {
if (isset($variant->conf['rb_misc_trigger']) && $variant->conf['rb_misc_trigger']) {
_rb_misc_add_variant_render_events($events, $task_info, $page, $variant);
}
}
}
}
}
}
return $events;
}