1

I have the following code in my header of a multilingual site. It produces the correct urls in english.

{% for entry in menuentries %}

    {% if entry.entryLink.first|length %}
        {% set navlink = entry.entryLink.first().uri %}
    {% elseif entry.customMenuUrl|length %}
        {% set navlink = entry.customMenuUrl %}
    {% endif %}

    {% if entry.level == 1 and entry.children|length %}
        <li class="dropdown">
            <a href="{{ siteUrl }}{{ navlink }}" class="dropdown-toggle {{ macros.activeLinkClass(entry.uri, entry.level)|trim }} level{{ entry.level }}" data-toggle="dropdown" role="button" data-hover="dropdown" data-length="{{ entry.title|length }}aria-haspopup="true" aria-expanded="false">{{ entry.title }} <span class="caret"></span></a>

            <ul class="dropdown-menu" >
                {% for child in entry.getDescendants() %}
                    <li>
                        <a  href="{{ siteUrl }}{{ child.entryLink.first().uri  }}" class="{{ macros.isActiveChildClass(child.slug) | trim }} level{{ child.level }}">{{ child.title }}</a>
                    </li>
                {% endfor %}
            </ul>
        </li>

    {% elseif entry.level == 1 and not entry.hasDescendants() %}

        <li>
            <a href="{{ siteUrl }}{{ navlink }}" class="{{ macros.activeLinkClass(entry.uri, entry.level) |trim }} level{{ entry.level }}">{{ entry.title }}</a>
        </li>

    {% endif %}

However when I switch languages eg. to french the child.entryLink.first().uri returns null. Even if I just change the en to fr I get the same result. Bit confused.

  • Are the entries selected in the entryLink field enabled for French? – Mats Mikkel Rummelhoff Jul 15 '16 at 8:19
  • I have checked field from menu "entryLink", and content entries - all are enabled and translatable. – joomkit Jul 15 '16 at 11:34
  • @joomkit Can you add your update as an official answer? – Brad Bell Jul 15 '16 at 17:03
  • I cant vote my own posts as answer...but happy to change - let me know what you need me to do – joomkit Jul 16 '16 at 13:52
2

UPDATE: Mats you were right - I didnt have any data in the french menus or i had random custom url data. Once corrected the entry model came back whole. Phew

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.