You are here

protected function FeaturesGenerationMethodBase::mergeInfoFile in Features 8.4

Same name and namespace in other branches
  1. 8.3 src/FeaturesGenerationMethodBase.php \Drupal\features\FeaturesGenerationMethodBase::mergeInfoFile()

Merges an info file into a package's info file.

Parameters

string $package_info: The Yaml encoded package info.

string $info_file_uri: The info file's URI.

2 calls to FeaturesGenerationMethodBase::mergeInfoFile()
FeaturesGenerationArchive::preparePackage in src/Plugin/FeaturesGeneration/FeaturesGenerationArchive.php
Reads and merges in existing files for a given package or profile.
FeaturesGenerationWrite::preparePackage in src/Plugin/FeaturesGeneration/FeaturesGenerationWrite.php
Reads and merges in existing files for a given package or profile.

File

src/FeaturesGenerationMethodBase.php, line 58

Class

FeaturesGenerationMethodBase
Base class for package assignment methods.

Namespace

Drupal\features

Code

protected function mergeInfoFile($package_info, $info_file_uri) {
  $package_info = Yaml::decode($package_info);

  // \Drupal\Core\Extension\InfoParser::parse() makes changes we don't want
  // here such as adding a core_incompatible key. Instead parse the file
  // directly.
  $existing_info = Yaml::decode(file_get_contents($info_file_uri));

  // Remove the 'core' property if present since it has been replaced with
  // 'core_version_requirement'.
  if (isset($existing_info['core'])) {
    unset($existing_info['core']);
  }
  return Yaml::encode($this->featuresManager
    ->mergeInfoArray($existing_info, $package_info));
}