root / drupal7 / sites / all / modules / feeds_jsonpath_parser / feeds_jsonpath_parser.api.php @ 6ae446a4
1 |
<?php
|
---|---|
2 |
|
3 |
/**
|
4 |
* @file
|
5 |
* Documentation of Feeds JSONPath parser hooks.
|
6 |
*/
|
7 |
|
8 |
/**
|
9 |
* Allows filtering or modifying a feed item.
|
10 |
*
|
11 |
* @param array &$item
|
12 |
* The feed item to modify.
|
13 |
*
|
14 |
* @return bool
|
15 |
* Returns true if the item should be skipped.
|
16 |
*/
|
17 |
function hook_feeds_jsonpath_parser_filter(array &$item, FeedsSource $source) { |
18 |
// Check for the importer.
|
19 |
if ($source->id != 'my_importer') { |
20 |
return;
|
21 |
} |
22 |
// 1) Alter the items array.
|
23 |
$item['title'] = 'A hard coded title'; |
24 |
|
25 |
// 2) Return TRUE which will cause this item to be skipped.
|
26 |
if ($item['title'] == 'An item I would like to skip.') { |
27 |
return TRUE; |
28 |
} |
29 |
} |