function aggregator_save_item
Adds/edits/deletes an aggregator item.
Parameters
$edit: An associative array describing the item to be added/edited/deleted.
1 call to aggregator_save_item()
- aggregator_aggregator_process in modules/
aggregator/ aggregator.processor.inc - Implements hook_aggregator_process().
File
-
modules/
aggregator/ aggregator.processor.inc, line 151
Code
function aggregator_save_item($edit) {
if ($edit['title'] && empty($edit['iid'])) {
$edit['iid'] = db_insert('aggregator_item')->fields(array(
'title' => $edit['title'],
'link' => $edit['link'],
'author' => $edit['author'],
'description' => $edit['description'],
'guid' => $edit['guid'],
'timestamp' => $edit['timestamp'],
'fid' => $edit['fid'],
))
->execute();
}
if ($edit['iid'] && !$edit['title']) {
db_delete('aggregator_item')->condition('iid', $edit['iid'])
->execute();
db_delete('aggregator_category_item')->condition('iid', $edit['iid'])
->execute();
}
elseif ($edit['title'] && $edit['link']) {
// file the items in the categories indicated by the feed
$result = db_query('SELECT cid FROM {aggregator_category_feed} WHERE fid = :fid', array(
':fid' => $edit['fid'],
));
foreach ($result as $category) {
db_merge('aggregator_category_item')->key(array(
'iid' => $edit['iid'],
'cid' => $category->cid,
))
->execute();
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.