$loader->setPageName(implode('/', $pagePath));
$loader->getRes()->addSetting([
'afform' => [
- 'name' => $pageArgs['afform'],
'open' => _afform_angular_module_name($pageArgs['afform'], 'dash'),
],
]);
this.getSchema = function getSchema(name) {
return schema[name];
};
+ // Returns the 'meta' record ('name', 'description', etc) of the active form.
+ this.getFormMeta = function getFormMeta() {
+ return $scope.$parent.meta;
+ };
this.loadData = function() {
var toLoad = 0;
_.each(schema, function(entity, entityName) {
}
});
if (toLoad) {
- crmApi4('Afform', 'prefill', {name: CRM.afform.name, args: $routeParams})
+ crmApi4('Afform', 'prefill', {name: this.getFormMeta().name, args: $routeParams})
.then(function(result) {
_.each(result, function(item) {
data[item.name] = _.extend(item.values, schema[item.name].data || {});
};
this.submit = function submit() {
- crmApi4('Afform', 'submit', {name: CRM.afform.name, args: $routeParams, values: data});
+ crmApi4('Afform', 'submit', {name: this.getFormMeta().name, args: $routeParams, values: data});
};
}
};