1 |
7b9e8704
|
Assos Assos
|
<?php
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* @file
|
5 |
|
|
* Filters out empty values from an array.
|
6 |
|
|
*/
|
7 |
|
|
|
8 |
|
|
$plugin = array(
|
9 |
|
|
'form' => 'feeds_tamper_array_filter_form',
|
10 |
|
|
'callback' => 'feeds_tamper_array_filter_callback',
|
11 |
|
|
'name' => 'Filter empty items',
|
12 |
|
|
'multi' => 'direct',
|
13 |
|
|
'category' => 'List',
|
14 |
|
|
);
|
15 |
|
|
|
16 |
|
|
function feeds_tamper_array_filter_form($importer, $element_key, $settings) {
|
17 |
|
|
$form = array();
|
18 |
|
|
$form['help'] = array(
|
19 |
|
|
'#markup' => t('Filter out empty values from a list.'),
|
20 |
|
|
);
|
21 |
|
|
return $form;
|
22 |
|
|
}
|
23 |
|
|
|
24 |
|
|
function feeds_tamper_array_filter_callback($result, $item_key, $element_key, &$field, $settings, $source) {
|
25 |
|
|
if (is_array($field)) {
|
26 |
|
|
$field = array_values(array_filter($field));
|
27 |
|
|
}
|
28 |
|
|
} |