From 94a6ba52c3def2abb34ef4644b04128f59a1648f Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Thu, 7 Jul 2022 18:19:26 -0400 Subject: [PATCH] REF - Remove unneeded return from private fn, add comments --- Civi/Angular/AngularLoader.php | 9 ++++----- js/crm.ajax.js | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Civi/Angular/AngularLoader.php b/Civi/Angular/AngularLoader.php index ecfb4797fb..086756a3b4 100644 --- a/Civi/Angular/AngularLoader.php +++ b/Civi/Angular/AngularLoader.php @@ -80,6 +80,7 @@ class AngularLoader { $this->region = \CRM_Utils_Request::retrieve('snippet', 'String') ? 'ajax-snippet' : 'html-header'; $this->pageName = \CRM_Utils_System::currentPath(); $this->modules = []; + // List of already-present modules may be provided by crmSnippet (see crm.ajax.js) if ($this->region === 'ajax-snippet' && !empty($_GET['crmAngularModules'])) { $this->modulesAlreadyLoaded = explode(',', $_GET['crmAngularModules']); } @@ -97,13 +98,13 @@ class AngularLoader { */ public function load() { \CRM_Core_Error::deprecatedFunctionWarning('angularjs.loader service'); - return $this->loadAngularResources(); + $this->loadAngularResources(); + return $this; } /** * Load scripts, styles & settings for the active modules. * - * @return $this * @throws \CRM_Core_Exception */ private function loadAngularResources() { @@ -132,7 +133,7 @@ class AngularLoader { if (!$moduleNames && $this->modulesAlreadyLoaded) { // No modules to load - return $this; + return; } if (!$this->isAllModules($moduleNames)) { $assetParams = ['modules' => implode(',', $moduleNames)]; @@ -214,8 +215,6 @@ class AngularLoader { $res->addBundle($bundles); } } - - return $this; } /** diff --git a/js/crm.ajax.js b/js/crm.ajax.js index 007c7f9346..82a8025a79 100644 --- a/js/crm.ajax.js +++ b/js/crm.ajax.js @@ -273,6 +273,7 @@ } else { url = url.replace(/snippet=[^&]*/, 'snippet=' + snippetType); } + // See Civi\Angular\AngularLoader if (snippetType === 'json' && CRM.angular) { url += '&crmAngularModules=' + CRM.angular.modules.join(); } -- 2.25.1