diff --git a/src/categories/data.js b/src/categories/data.js index ddbc6362e3a0..9097fb5aa098 100644 --- a/src/categories/data.js +++ b/src/categories/data.js @@ -4,6 +4,7 @@ const validator = require('validator'); const db = require('../database'); const meta = require('../meta'); +const plugins = require('../plugins'); const intFields = [ 'cid', 'parentCid', 'disabled', 'isSection', 'order', @@ -19,8 +20,14 @@ module.exports = function (Categories) { const keys = cids.map(cid => 'category:' + cid); const categories = await (fields.length ? db.getObjectsFields(keys, fields) : db.getObjects(keys)); - categories.forEach(category => modifyCategory(category, fields)); - return categories; + const result = await plugins.fireHook('filter:category.getFields', { + cids: cids, + categories: categories, + fields: fields, + keys: keys, + }); + result.categories.forEach(category => modifyCategory(category, fields)); + return result.categories; }; Categories.getCategoryData = async function (cid) {