openaire-library/utils/entities/adminTool/plugin.ts

30 lines
788 B
TypeScript

import {PluginTemplate} from "./pluginTemplate";
export class Plugin {
_id: string;
code: string;
page: string;
pid:string;
placement: string;
order: string;
active:boolean;
priorTo:boolean;
object:any;
settingsValues:Map<string,string> = new Map<string, string>();
constructor(page, pid, template:PluginTemplate) {
console.log(template)
this.page = page;
this.pid = pid;
this.code = template.code;
this.placement = template.placements ? template.placements[0] : null;
this.active = false;
this.object = template.object ? Object.assign(template.object) : null;
if (template.settings) {
for (let attr of Object.keys(template.settings)) {
this.settingsValues.set(attr, template.settings[attr].value)
}
}
}
}