Skip to content

Instantly share code, notes, and snippets.

@ankedsgn
Created December 17, 2020 10:35
Show Gist options
  • Save ankedsgn/bcb77301dafb3f3bff82f84e1de5ea43 to your computer and use it in GitHub Desktop.
Save ankedsgn/bcb77301dafb3f3bff82f84e1de5ea43 to your computer and use it in GitHub Desktop.
Check drupal for url in twig
{% set currenturl = url('<current>')|render|render %}
<select class="nav-top-level__select" name="nav-select" id="structure-nav-select" onchange="navSelect(value);">
{% for item in menu %}
<option value="{{ item.url }}" {% if item.url in currenturl %} selected {% endif %}>{{ item.text }}</option>
{% endfor %}
</select>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment