Created
December 20, 2013 19:32
-
-
Save ftdysa/8060088 to your computer and use it in GitHub Desktop.
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
<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> |
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
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)); | |
} |
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
<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