Révision a192dc0b
Ajouté par Assos Assos il y a environ 8 ans
drupal7/sites/all/modules/feeds/mappers/list.inc | ||
---|---|---|
49 | 49 |
/** |
50 | 50 |
* Callback for setting list_boolean fields. |
51 | 51 |
*/ |
52 |
function list_feeds_set_boolean_target(FeedsSource $source, $entity, $target, array $values) { |
|
53 |
$field = isset($entity->$target) ? $entity->$target : array(LANGUAGE_NONE => array()); |
|
52 |
function list_feeds_set_boolean_target(FeedsSource $source, $entity, $target, array $values, array $mapping) { |
|
53 |
$language = $mapping['language']; |
|
54 |
|
|
55 |
$field = isset($entity->$target) ? $entity->$target : array($language => array()); |
|
54 | 56 |
|
55 | 57 |
foreach ($values as $value) { |
56 | 58 |
|
... | ... | |
58 | 60 |
$value = $value->getValue(); |
59 | 61 |
} |
60 | 62 |
|
61 |
$field[LANGUAGE_NONE][] = array('value' => (int) (bool) $value); |
|
63 |
if (is_string($value) && strlen($value) == 0) { |
|
64 |
// Don't convert an empty string to a boolean. |
|
65 |
continue; |
|
66 |
} |
|
67 |
if (is_null($value)) { |
|
68 |
// Don't convert a NULL value to a boolean. |
|
69 |
continue; |
|
70 |
} |
|
71 |
|
|
72 |
$field[$language][] = array('value' => (int) (bool) $value); |
|
62 | 73 |
} |
63 | 74 |
|
64 | 75 |
$entity->$target = $field; |
Formats disponibles : Unified diff
Weekly update of contrib modules