commit
03879074ec
|
@ -34,6 +34,7 @@ export class CoreSitePluginsBlockComponent extends CoreBlockBaseComponent implem
|
|||
@HostBinding('class') component?: string;
|
||||
method?: string;
|
||||
args?: Record<string, unknown>;
|
||||
jsData?: Record<string, unknown>; // Data to pass to the component.
|
||||
initResult?: CoreSitePluginsContent | null;
|
||||
|
||||
constructor() {
|
||||
|
@ -62,6 +63,9 @@ export class CoreSitePluginsBlockComponent extends CoreBlockBaseComponent implem
|
|||
instanceid: this.instanceId,
|
||||
blockid: this.block.instanceid,
|
||||
};
|
||||
this.jsData = {
|
||||
block: this.block,
|
||||
};
|
||||
this.initResult = handler.initResult;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
<core-site-plugins-plugin-content *ngIf="component && method" [component]="component" [method]="method" [args]="args"
|
||||
[initResult]="initResult" />
|
||||
[initResult]="initResult" [data]="jsData" />
|
||||
|
|
|
@ -118,7 +118,11 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck {
|
|||
this.data = this.data || {};
|
||||
this.forceCompile = true;
|
||||
|
||||
this.jsData = Object.assign(this.data, CoreSitePlugins.createDataForJS(this.initResult, result));
|
||||
this.jsData = {
|
||||
...this.args,
|
||||
...this.data,
|
||||
...CoreSitePlugins.createDataForJS(this.initResult, result),
|
||||
};
|
||||
|
||||
// Pass some methods as jsData so they can be called from the template too.
|
||||
this.jsData.fetchContent = (refresh?: boolean) => this.fetchContent(refresh);
|
||||
|
|
Loading…
Reference in New Issue