Skip to content

Commit

Permalink
TieredMenu MenubarSub templating fixes #5639
Browse files Browse the repository at this point in the history
  • Loading branch information
yigitfindikli committed Dec 27, 2023
1 parent c314fa6 commit f7c3f6d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 2 additions & 4 deletions components/lib/menubar/MenubarSub.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,7 @@ export const MenubarSub = React.memo(
</a>
);

let template = getItemProp(processedItem, 'template');

if (template) {
if (item.template) {
const defaultContentOptions = {
className: linkClassName,
labelClassName: 'p-menuitem-text',
Expand All @@ -216,7 +214,7 @@ export const MenubarSub = React.memo(
props
};

content = ObjectUtils.getJSXElement(processedItem, item, defaultContentOptions);
content = ObjectUtils.getJSXElement(item.template, item, defaultContentOptions);
}

const contentProps = mergeProps(
Expand Down
5 changes: 2 additions & 3 deletions components/lib/tieredmenu/TieredMenuSub.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,6 @@ export const TieredMenuSub = React.memo(
const _icon = getItemProp(processedItem, 'icon');
const target = getItemProp(processedItem, 'target');
const url = getItemProp(processedItem, 'url');
const template = getItemProp(processedItem, 'template');
const key = getItemId(processedItem);
const focused = isItemFocused(processedItem);
const active = isItemActive(processedItem);
Expand Down Expand Up @@ -216,7 +215,7 @@ export const TieredMenuSub = React.memo(
</a>
);

if (template) {
if (item.template) {
const defaultContentOptions = {
className: linkClassName,
labelClassName: 'p-menuitem-text',
Expand All @@ -228,7 +227,7 @@ export const TieredMenuSub = React.memo(
disabled: disabled
};

content = ObjectUtils.getJSXElement(template, item, defaultContentOptions);
content = ObjectUtils.getJSXElement(item.template, item, defaultContentOptions);
}

const contentProps = mergeProps(
Expand Down

0 comments on commit f7c3f6d

Please sign in to comment.