Skip to content

Instantly share code, notes, and snippets.

@dfritschy
Created October 18, 2013 14:05
Show Gist options
  • Save dfritschy/7042030 to your computer and use it in GitHub Desktop.
Save dfritschy/7042030 to your computer and use it in GitHub Desktop.
TWIG embed template for files, corresponding override rules
{# Embed File View
{{ ez_render_field( content, 'file') }} would be easier, but renders the file name instead of the object name
#}
<div class="content-view-embed">
{% if content.fields['file'] is defined %}
{% set uri = 'content/download/' ~ content.contentInfo.id ~ '/' ~ content.getField('file').id
~ '/version/' ~ content.contentInfo.currentVersionNo ~ "/file/"
~ content.getField('file').value.fileName|escape( 'url' ) %}
<div class="attribute-file">
<a href="{{ path( 'ez_legacy', {'module_uri': uri} ) }}">{{ content.contentInfo.name }}</a>
</div>
{% endif %}
</div>
# We explicitly prepend config for "ezpublish" namespace in service container extension,
# so no need to repeat it here
system:
drucknatuer_user:
location_view:
full:
full_ps_produkt:
template: WebmanufakturSiteDruckformBundle:full:ps_produkt.html.twig
match:
Identifier\ContentType: ps_produkt
full_ps_folder_section:
template: WebmanufakturSiteDruckformBundle:full:ps_folder_section.html.twig
match:
Identifier\ContentType: ps_folder_section
# default full view template
full_default:
template: WebmanufakturSiteDruckformBundle::full.html.twig
line:
# default line view template
line_default:
template: WebmanufakturSiteDruckformBundle::line.html.twig
content_view:
embed:
embed_file:
template: WebmanufakturSiteDruckformBundle:embed:file.html.twig
match:
Identifier\ContentType: file
field_templates:
-
template: WebmanufakturSiteDruckformBundle:fields:field_templates.html.twig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment