function feeds_para_mapper_update_paragraphs in Feeds Paragraphs 7
Removes unwanted Paragraphs entities, and marks others for values changes.
Parameters
array $mapping: Information about the target field and the target paragraph.
array $entities: The existing Paragraphs entities.
array $slices: The sliced values based on user choice & the field cardinality.
Return value
array The updated entities.
1 call to feeds_para_mapper_update_paragraphs()
- feeds_para_mapper_init_host_paragraphs in ./
feeds_para_mapper.module - Creates empty host Paragraphs entities or gets the existing ones.
File
- ./
feeds_para_mapper.module, line 784 - Allows feeds to import content to Paragraphs' fields.
Code
function feeds_para_mapper_update_paragraphs(array $mapping, array $entities, array $slices) {
$items = array();
$slices = feeds_para_mapper_check_values_changes($mapping, $slices, $entities);
for ($i = 0; $i < count($slices); $i++) {
if ($slices[$i]['state'] === "remove") {
$entities[$i]
->delete();
}
else {
unset($slices[$i]['state']);
$items[] = array(
'paragraph' => $entities[$i],
'value' => $slices[$i],
);
}
}
return $items;
}