private function Importer::updateParagraphs in Feeds Paragraphs 8
Removes unwanted Paragraphs entities, and marks others for values changes.
Parameters
Paragraph[] $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 Importer::updateParagraphs()
- Importer::initHostParagraphs in src/
Importer.php - Creates empty host Paragraphs entities or gets the existing ones.
File
- src/
Importer.php, line 386
Class
Namespace
Drupal\feeds_para_mapperCode
private function updateParagraphs($entities, array $slices) {
$items = array();
$slices = $this
->checkValuesChanges($slices, $entities);
for ($i = 0; $i < count($slices); $i++) {
if (!isset($entities[$i])) {
continue;
}
// we should never delete data, if we should remove the entity then just ignore it,
// we use cleanUp() to to set the fields values to null.
if ($slices[$i]['state'] !== "remove") {
$state = $slices[$i]['state'];
unset($slices[$i]['state']);
$items[] = array(
'paragraph' => $entities[$i],
'value' => $slices[$i],
'state' => $state,
);
}
}
return $items;
}