Closed ShaneHowell closed 7 years ago
Hi Shane, Were you able to get an answer to your problem? Also, what is the use for getting the handle from the Display navigation field type? I tried to put in into {% set sidenav = craft.amNav.getNavRaw({{ entry.displayNavigationHandle}}) %} but it gives me errors whether I use quotes or not. Just trying to do a dynamically added navigation if its possible
@iamcyberio, not per-say.
If I recall correctly I ended up creating a parent and added the links as children, then I was able to pull the parent nodes props.
As for making it dynamic, this is how I achieved it:
{% set sidebar = craft.amNav.getNavRaw(entry.sidebarNavigation) %}
<section class="sidebar">
{% for node in sidebar %}
<h2>
<a href="{{ node.url }}" title="{{ node.name }}">{{ node.name }}</a>
</h2>
<ul>
{% for subnode in node.children %}
<li class="{% if subnode.active %}sub-nav--active{% endif %}">
<a href="{{ subnode.url }}" title="{{ subnode.name }}" {% if subnode.active %}class="sidebar--active"{% endif %}>{{ subnode.name }}</a>
</li>
{% endfor %}
</ul>
{% endfor %}
</section>
entry.sidebarNavigation
is your field handle where you select the nav to include. In my case, it's a Display navigation
field.
I'm also going to close this issue as it was never addressed here and i'm uncertain if an update was made to fix it.
You can get the handle using the
Display navigation
field type but as far as I can tell you can't get the Name/Title of the navigation element from the dropdown.Ex:
I can get the above's
handle
but not theName
(orTitle
). So all i'm able to get isdiningShoppingServices
but I'd like to get the title as well to display likeDining, Shopping & Services
.Is there a way to do this that i'm overlooking?