From 920161ed9b28972bb0683aa12f546045ff8b2abb Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Tue, 13 Oct 2020 17:29:29 -0700 Subject: [PATCH] dev/core#2117 - scriptFile, styleFile - Automatically register URL aliases This allows backward compatibility for customizations which targetted these resources by their URL. --- CRM/Core/Resources/CollectionTrait.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CRM/Core/Resources/CollectionTrait.php b/CRM/Core/Resources/CollectionTrait.php index 38abdea679..71fe17ece0 100644 --- a/CRM/Core/Resources/CollectionTrait.php +++ b/CRM/Core/Resources/CollectionTrait.php @@ -114,6 +114,9 @@ trait CRM_Core_Resources_CollectionTrait { } $snippet['scriptFileUrls'] = [$res->getUrl($ext, $res->filterMinify($ext, $file), TRUE)]; } + if ($snippet['type'] === 'scriptFile' && !isset($snippet['aliases'])) { + $snippet['aliases'] = $snippet['scriptFileUrls']; + } if ($snippet['type'] === 'styleFile' && !isset($snippet['styleFileUrls'])) { /** @var Civi\Core\Themes $theme */ @@ -121,6 +124,9 @@ trait CRM_Core_Resources_CollectionTrait { list ($ext, $file) = $snippet['styleFile']; $snippet['styleFileUrls'] = $theme->resolveUrls($theme->getActiveThemeKey(), $ext, $file); } + if ($snippet['type'] === 'styleFile' && !isset($snippet['aliases'])) { + $snippet['aliases'] = $snippet['styleFileUrls']; + } if (isset($snippet['aliases']) && !is_array($snippet['aliases'])) { $snippet['aliases'] = [$snippet['aliases']]; -- 2.25.1