Created
April 4, 2012 01:08
-
-
Save alOneh/2296894 to your computer and use it in GitHub Desktop.
Macros for twig template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{# Todo : Manage dropdown and search form #} | |
{% macro navbar(items, active, options) %} | |
{% set active = active|default('home') %} | |
{% set options = { | |
'fixed': '', | |
'divider': ''|default(false), | |
'brand': '' | |
}|merge(options|default({})) | |
%} | |
<div class="navbar {% if options.fixed %}navbar-fixed-{{ options.fixed }}{% endif %}"> | |
<div class="navbar-inner"> | |
<div class="container"> | |
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> | |
<span class="icon-bar"></span> | |
<span class="icon-bar"></span> | |
<span class="icon-bar"></span> | |
</a> | |
{% set brand = options.brand %} | |
{% if brand %} | |
<a class="brand" href="{{ brand.url }}">{{ brand.name }}</a> | |
{% endif %} | |
<div class="nav-collapse"> | |
<ul class="nav"> | |
{% for item in items %} | |
{% if options.divider %}<li class="divider-vertical"></li>{% endif %} | |
<li {% if item.id == active %}class="active"{% endif %}> | |
<a href="{{ item.url }}">{{ item.label }}</a> | |
</li> | |
{% endfor %} | |
</ul> | |
</div><!--/.nav-collapse --> | |
</div> | |
</div> | |
</div> | |
{% endmacro %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment