function fb_instant_articles_rss_mass_update in Facebook Instant Articles 7
Same name and namespace in other branches
- 7.2 modules/fb_instant_articles_rss/fb_instant_articles_rss.module \fb_instant_articles_rss_mass_update()
Makes mass update of fia_enabled status for selected nodes.
Parameters
array $nodes: Array of node nids to update.
boolean $fia_enabled: Boolean indicating publishing status of node.
1 string reference to 'fb_instant_articles_rss_mass_update'
- fb_instant_articles_rss_node_operations in modules/
fb_instant_articles_rss/ fb_instant_articles_rss.module - Implements hook_node_operations().
File
- modules/
fb_instant_articles_rss/ fb_instant_articles_rss.module, line 76 - Facebook Instant Articles RSS module.
Code
function fb_instant_articles_rss_mass_update($nodes, $fia_enabled) {
// We need node objects here to retrieve content type and it's fia settings.
$load_nodes = entity_load('node', array_keys($nodes));
$fia_types = fb_instant_articles_display_get_article_entity_types();
foreach ($load_nodes as $node) {
if (in_array($node->type, array_keys($fia_types['node']))) {
if ($fia_enabled) {
fb_instant_articles_rss_set_entity($node->nid, $fia_enabled);
}
else {
fb_instant_articles_rss_delete_entity($node->nid);
}
}
}
drupal_set_message(t('Selected nodes where %action Facebook Instant Articles RSS feed.', array(
'%action' => $fia_enabled ? t('published on') : t('unpublished from'),
)));
}