You are here

private function Importer::sliceValues in Feeds Paragraphs 8

Slices values.

Return value

array

1 call to Importer::sliceValues()
Importer::initHostParagraphs in src/Importer.php
Creates empty host Paragraphs entities or gets the existing ones.

File

src/Importer.php, line 753

Class

Importer

Namespace

Drupal\feeds_para_mapper

Code

private function sliceValues() {
  $max = $this->mapper
    ->getMaxValues($this->target, $this->configuration);
  if ($max > -1) {

    // if has sub values:
    if (count($this->values) > 1) {
      $flattened = $this
        ->flattenArray($this->values);
      $slices = array_chunk($flattened, $max);
    }
    else {
      $slices = array_chunk($this->values, $max);
    }
  }
  else {
    $slices = array(
      $this->values,
    );
  }
  return $slices;
}