Skip to content

Instantly share code, notes, and snippets.

@sam016
Forked from mortendk/breadcrump.twig
Last active January 13, 2017 17:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sam016/521f9413240a9a7636366818e11f3b86 to your computer and use it in GitHub Desktop.
Save sam016/521f9413240a9a7636366818e11f3b86 to your computer and use it in GitHub Desktop.
twig breadcrumbs
{#
/**
* @file
* Returns HTML for a breadcrumb trail.
*
* @param $variables
* An associative array containing:
* - breadcrumb: An array containing the breadcrumb links.
*
* @ingroup themeable
*/
#}
{% if breadcrumb is defined %}
<nav class="breadcrumb" role="navigation">
<h2 class="element-invisible">{{ 'You are here'|t }}</h2>
<ol>
{% for item in breadcrumb %}
{% if loop.last %}
<li>{{ item }}</li>
{% else %}
<li>{{ item }} » </li>
{% endif %}
{% endfor %}
</ol>
</nav>
{% endif %}
@sam016
Copy link
Author

sam016 commented Jan 13, 2017

Reduced one conditional statement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment