public function ComposerJsonSource::getPatches in PatchInfo 8.2
Gets patch information for a module from a patch source.
$return['ctools'] = [
0 => [
'info' => 'https://www.drupal.org/node/1739718 Issue 1739718, Patch #32',
'source' => 'modules/contrib/ctools/ctools.info.yml',
],
];
Parameters
array $info: The parsed .info.yml file contents of the module to get patches for.
\Drupal\Core\Extension\Extension $file: Full information about the module or theme to get patches for.
string $type: Either 'module' or 'theme'.
Return value
array An array of patch information arrays keyed by machine-readable name of target module. The patch information array for each target module is an integer-keyed array of patch information. The patch information is an array with two keys, 'info' and 'source'. The 'info' key contains the patch information, i.e. a string with a URL followed by any patch description. The URL is optional. 'source' is a string, that contains a human-readable source information for the patch information.
Overrides PatchInfoSourceBase::getPatches
File
- modules/
patchinfo_source_composer/ src/ Plugin/ PatchInfo/ Source/ ComposerJsonSource.php, line 76
Class
- ComposerJsonSource
- Gathers patch information from composer.json files.
Namespace
Drupal\patchinfo_source_composer\Plugin\patchinfo\sourceCode
public function getPatches(array $info, Extension $file, string $type) {
$return = [];
if (!in_array($type, [
'module',
'theme',
])) {
return $return;
}
$patches = $this
->parseComposerFile($file
->getPath());
$return = array_merge_recursive($return, $patches);
if ($file
->getName() == 'system') {
// Check for patches in /composer.json, ../composer.json and
// /core/composer.json.
$core_base_path = str_replace('/modules/system', '', $file
->getPath());
$patches = $this
->parseComposerFile($core_base_path);
$return = array_merge_recursive($return, $patches);
$patches = $this
->parseComposerFile('.');
$return = array_merge_recursive($return, $patches);
$patches = $this
->parseComposerFile('..');
$return = array_merge_recursive($return, $patches);
}
return $return;
}