You are here

protected function MigrationDefinitionCreator::getGroupedDefinitions in GatherContent 8.5

Return the concatenated definitions for the given template.

1 call to MigrationDefinitionCreator::getGroupedDefinitions()
MigrationDefinitionCreator::createMigrationDefinition in src/MigrationDefinitionCreator.php
Create migration definitions.

File

src/MigrationDefinitionCreator.php, line 165

Class

MigrationDefinitionCreator
Create dynamic migration definitions.

Namespace

Drupal\gathercontent

Code

protected function getGroupedDefinitions() {
  $groupedData = [];
  foreach ($this->mappingData as $data) {
    $language = $this->siteDefaultLangCode;
    if (isset($data['language'])) {
      $language = $data['language'];
    }
    if (!empty($data['type']) && $data['type'] === 'metatag' && $this->moduleHandler
      ->moduleExists('metatag') && $this->metatagQuery
      ->checkMetatag($this->mapping
      ->getMappedEntityType(), $this->mapping
      ->getContentType())) {
      $data['metatag_elements'] = $data['elements'];
      $data['elements'] = [];
    }
    if (empty($groupedData[$language]['data'])) {
      $groupedData[$language]['data'] = [];
    }
    $groupedData[$language]['data'] = $this
      ->arrayMergeRecursiveDistinct($groupedData[$language]['data'], $data);
  }
  return $this
    ->getDefinitions($groupedData);
}