Skip to content

Commit

Permalink
Merge branch '2' into 3
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Oct 21, 2024
2 parents eb982e2 + b6cb834 commit 76d91f8
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/Transformer/YamlTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Exception;
use Closure;
use SilverStripe\Config\Collections\MemoryConfigCollection;
use SilverStripe\Dev\Deprecation;

class YamlTransformer implements TransformerInterface
{
Expand Down Expand Up @@ -135,6 +136,15 @@ private function checkForDeprecatedConfig(array $document, MutableConfigCollecti
if (!($collection instanceof MemoryConfigCollection)) {
return;
}
$showNoticesCalledFromSupportedCode = false;
if (class_exists(Deprecation::class)
&& method_exists(Deprecation::class, 'getShowNoticesCalledFromSupportedCode')
) {
$showNoticesCalledFromSupportedCode = Deprecation::getShowNoticesCalledFromSupportedCode();
}
if ($document['inSupportedModule'] && !$showNoticesCalledFromSupportedCode) {
return;
}
foreach ($document['content'] as $key => $value) {
if (!is_array($value)) {
continue;
Expand Down Expand Up @@ -240,8 +250,14 @@ protected function getNamedYamlDocuments()
);
}

$inSupportedModule = false;
if (class_exists(Deprecation::class) && method_exists(Deprecation::class, 'fileIsInSupportedModule')) {
$inSupportedModule = Deprecation::fileIsInSupportedModule($document['filename']);
}
$filename = $document['filename'];
$documents[$header['name']] = [
'filename' => $document['filename'],
'filename' => $filename,
'inSupportedModule' => $inSupportedModule,
'header' => $header,
'content' => $content,
];
Expand Down

0 comments on commit 76d91f8

Please sign in to comment.