Skip to content

Instantly share code, notes, and snippets.

@ftdysa
Created December 20, 2013 19:32
Show Gist options
  • Save ftdysa/8060088 to your computer and use it in GitHub Desktop.
Save ftdysa/8060088 to your computer and use it in GitHub Desktop.
<ul class="nav nav-tabs">
{% for tab in tabs %}
<li><a id="{{ tab.id }}_tab" href="{{ tab.url }}" data-toggle="tab">{{ tab.title }}</a></li>
{% endfor %}
</ul>
<!-- Tab panes -->
<div class="tab-content">
{% for tab in tabs %}
<div class="tab-pane" id="{{ tab.id }}_content">
{{ tab.content }}
</div>
{% endfor %}
</div>
public function getFunctions() {
return array(
'tabs' => new \Twig_Function_Method($this, 'toTabs', array('needs_environment' => true))
);
}
public function toTabs(\Twig_Environment $environment, array $data) {
return $environment->render('MyBundle:Layout:tabs.html.twig', array('tabs' => $data));
}
<div class="row">
{{ tabs(tabs)|raw }}
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment