Skip to content

Instantly share code, notes, and snippets.

@hubertperron
Created August 14, 2013 19:26
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 hubertperron/6234629 to your computer and use it in GitHub Desktop.
Save hubertperron/6234629 to your computer and use it in GitHub Desktop.
{% macro generate(mapping) %}
{% if mapping.type == 'route' %}
<a href="{{ path(mapping.target) }}">{{ mapping.section|default('Link'|trans) }}</a>
{% elseif mapping.type == 'render' %}
{{ render(controller(mapping.target)) }}
{% elseif mapping.type == 'include' %}
{% include mapping.target %}
{% elseif mapping.type == 'url' %}
<a href="{{ mapping.target }}">{{ mapping.section|default('Link'|trans) }}</a>
{% elseif mapping.type == 'raw' %}
{{ mapping.target|raw }}
{% endif %}
{% endmacro %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment