$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']);
}
*/
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() {
if (!$moduleNames && $this->modulesAlreadyLoaded) {
// No modules to load
- return $this;
+ return;
}
if (!$this->isAllModules($moduleNames)) {
$assetParams = ['modules' => implode(',', $moduleNames)];
$res->addBundle($bundles);
}
}
-
- return $this;
}
/**
} else {
url = url.replace(/snippet=[^&]*/, 'snippet=' + snippetType);
}
+ // See Civi\Angular\AngularLoader
if (snippetType === 'json' && CRM.angular) {
url += '&crmAngularModules=' + CRM.angular.modules.join();
}