Skip to content

Commit

Permalink
Merge pull request #23967 from colemanw/angularCleanup
Browse files Browse the repository at this point in the history
REF - Remove unneeded return from private fn, add comments
  • Loading branch information
eileenmcnaughton authored Jul 8, 2022
2 parents cf9fd82 + 94a6ba5 commit c98e5bd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Civi/Angular/AngularLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public function __construct() {
$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']);
}
Expand All @@ -97,13 +98,13 @@ public function __construct() {
*/
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() {
Expand Down Expand Up @@ -132,7 +133,7 @@ private function loadAngularResources() {

if (!$moduleNames && $this->modulesAlreadyLoaded) {
// No modules to load
return $this;
return;
}
if (!$this->isAllModules($moduleNames)) {
$assetParams = ['modules' => implode(',', $moduleNames)];
Expand Down Expand Up @@ -214,8 +215,6 @@ private function loadAngularResources() {
$res->addBundle($bundles);
}
}

return $this;
}

/**
Expand Down
1 change: 1 addition & 0 deletions js/crm.ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit c98e5bd

Please sign in to comment.