2
0
Fork 0
tcrud/lib/plugin/server/config/config-tmenu.js
2017-06-10 16:53:29 +02:00

29 lines
759 B
JavaScript

var configRegistry = require('./../../../config-registry');
module.exports = (function () {
return function ServerConfigTMenuPlugin() {
this.configPlugin = function (ctx) {
ctx.key = 'serverConfigTMenu';
ctx.description = 'Exports tmenu.';
ctx.localDir = __dirname;
ctx.localConfigTemplate = 'config-tmenu.json';
};
this.configServer = function(ctx) {
ctx.server.get(ctx.createSlugApiServerBase(),ctx.renderFunctionJSON(function() {
var result = {};
for (var key in configRegistry.getMasterConfig().rootTMenu) {
var value = configRegistry.getMasterConfig().rootTMenu[key];
if (value.items.length > 0) {
result[key] = value; // remove empty menus
}
}
return result;
}));
};
};
})();