function views_atom_rules_action_add_to_feed in Views Atom 6
Same name and namespace in other branches
- 7 views_atom.rules.inc \views_atom_rules_action_add_to_feed()
Rule implementation callback for adding a node to a feed.
Parameters
$node: The node that triggered this action.
$settings: Configuration specified by the user.
File
- ./
views_atom.rules.inc, line 67
Code
function views_atom_rules_action_add_to_feed($node, $settings) {
$nid = $node->nid;
$view = views_get_view($settings['view']);
$view
->set_display($settings['view_display']);
if ($view
->access($settings['view_display'])) {
// If this node existed in the system prior to this page request, there is a chance
// that it needs to be reloaded and thus node_load() needs to be reset.
node_load($param = array(), $revision = NULL, $reset = TRUE);
// Get the atom-formatted-data for this node.
$result = $view
->preview($settings['view_display'], array(
$nid,
));
// Only PuSH the feed if there is actual data. The view may have filtered
// our nids down to 0, in which case we don't want to send anything. Because
// normal View requests (Pull-based) are unaffected, Atom subscriptions still
// work as normal.
if (!empty($view->result)) {
$topic_url = url($view->display[$view->current_display]->display_options['path'], array(
'absolute' => TRUE,
));
// This uses the Drupal Queue module to actually send notifications later.
push_hub_notify($topic_url, $result);
}
}
}