DEV: Make context available to ExtraNavItems

This context is available to other NavItems so this makes things more
consistent.
This commit is contained in:
Daniel Waterworth 2019-11-15 13:42:40 +00:00
parent 5c59247c3a
commit 337fdccfeb
1 changed files with 7 additions and 1 deletions

View File

@ -198,8 +198,14 @@ NavItem.reopenClass({
i => i !== null && !(category && i.get("name").indexOf("categor") === 0)
);
const context = {
category: args.category,
tagId: args.tagId,
noSubcategories: args.noSubcategories
};
const extraItems = NavItem.extraNavItemDescriptors
.map(descriptor => ExtraNavItem.create(descriptor))
.map(descriptor => ExtraNavItem.create(_.merge({}, context, descriptor)))
.filter(item => {
if (!item.customFilter) return true;
return item.customFilter(category, args);