掲示板

Icon not shown for child menu

8年前 に Gwowen Fu によって更新されました。

Icon not shown for child menu

Expert 投稿: 315 参加年月日: 10/12/27 最新の投稿
Hi,
I want to set icon on child menus. I select icon for each menu in Site Pages -> Advanced page. Only the root menu shows icon, the child menu doesn't show the icon.
Should the icon displayed for child menu of the root menu?

I am using the OOB Classic theme and Liferay is Portal Enterprise Edition 6.2.10 EE GA1

Thank you!
Gwowen
thumbnail
8年前 に David H Nebinger によって更新されました。

RE: Icon not shown for child menu

Liferay Legend 投稿: 14914 参加年月日: 06/09/02 最新の投稿
That's a question for your theme developer. If it's not in the navigation.vm, it's not going to be in the menu.
8年前 に Gwowen Fu によって更新されました。

RE: Icon not shown for child menu

Expert 投稿: 315 参加年月日: 10/12/27 最新の投稿
David H Nebinger:
That's a question for your theme developer. If it's not in the navigation.vm, it's not going to be in the menu.


Hi David, I am using the OOB Classic theme. because the icon is configurable through the control panel so I though it should work for any menu item no matter it is a child menu or not.
thumbnail
8年前 に David H Nebinger によって更新されました。

RE: Icon not shown for child menu

Liferay Legend 投稿: 14914 参加年月日: 06/09/02 最新の投稿
The classic theme doesn't support inner icons.

The main nav has the following:

<a aria-labelledby="layout_$nav_item.getLayoutId()" $nav_item_attr_has_popup class="$nav_item_link_css_class" href="$nav_item.getURL()" $nav_item.getTarget() role="menuitem">
<span>$nav_item.icon() $nav_item.getName() $nav_item_caret</span>
</a>

However, the child nav items has simply:

<a aria-labelledby="layout_$nav_child.getLayoutId()" href="$nav_child.getURL()" $nav_child.getTarget() role="menuitem">$nav_child.getName()</a>

As you can see, it's a matter for the theme developer. In this case the classic theme dev did not include icons for the child menu items.
8年前 に Gwowen Fu によって更新されました。

RE: Icon not shown for child menu (回答)

Expert 投稿: 315 参加年月日: 10/12/27 最新の投稿
David H Nebinger:
The classic theme doesn't support inner icons.

The main nav has the following:

<a aria-labelledby="layout_$nav_item.getLayoutId()" $nav_item_attr_has_popup class="$nav_item_link_css_class" href="$nav_item.getURL()" $nav_item.getTarget() role="menuitem">
<span>$nav_item.icon() $nav_item.getName() $nav_item_caret</span>
</a>

However, the child nav items has simply:

<a aria-labelledby="layout_$nav_child.getLayoutId()" href="$nav_child.getURL()" $nav_child.getTarget() role="menuitem">$nav_child.getName()</a>

As you can see, it's a matter for the theme developer. In this case the classic theme dev did not include icons for the child menu items.


David, Thank you! Adding $nav_child.icon() to the child menu item solved the issue.
thumbnail
8年前 に Juan Gonzalez によって更新されました。

RE: Icon not shown for child menu

Liferay Legend 投稿: 3089 参加年月日: 08/10/28 最新の投稿
Hi Gwowen,

I guess David is right, if you look at the navigation.vm file in classic theme (6.2.3 GA4) you can see this:

https://github.com/liferay/liferay-portal/blob/6.2.3-ga4/portal-web/docroot/html/themes/classic/_diffs/templates/navigation.vm#L26

So, just create a custom theme and customize navigation.vm to add the icon wherever you want.
8年前 に Gwowen Fu によって更新されました。

RE: Icon not shown for child menu

Expert 投稿: 315 参加年月日: 10/12/27 最新の投稿
Juan, thank you for the reply. Do you know why the icon code is not added to the Classic template since the icon is already configurable in the control panel?
thumbnail
8年前 に David H Nebinger によって更新されました。

RE: Icon not shown for child menu

Liferay Legend 投稿: 14914 参加年月日: 06/09/02 最新の投稿
I can't speak for them, but any theme decision is based upon the UI requirements.

I think it's a mistake to see the classic theme as something that you should use as-is. It contains a number of assumptions that may (or may not) match your own UI requirements.

But remember it's really there to demonstrate what is capable in a Liferay theme. Think of it more like a demo theme and less like a foundation for your site.
8年前 に Gwowen Fu によって更新されました。

RE: Icon not shown for child menu

Expert 投稿: 315 参加年月日: 10/12/27 最新の投稿
David H Nebinger:
I can't speak for them, but any theme decision is based upon the UI requirements.

I think it's a mistake to see the classic theme as something that you should use as-is. It contains a number of assumptions that may (or may not) match your own UI requirements.

But remember it's really there to demonstrate what is capable in a Liferay theme. Think of it more like a demo theme and less like a foundation for your site.


Thank for the information, that is good to know.