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; })); }; }; })();