On this page
function aggregator_save_item
aggregator_save_item($edit)
Adds/edits/deletes an aggregator item.
Parameters
$edit: An associative array describing the item to be added/edited/deleted.
File
- modules/aggregator/aggregator.processor.inc, line 151
- Processor functions for the aggregator module.
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();
}
}
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!aggregator!aggregator.processor.inc/function/aggregator_save_item/7.x