Skip to content

Instantly share code, notes, and snippets.

@Schweriner
Created June 11, 2025 13:18
Show Gist options
  • Save Schweriner/9f252341bd5a131c82db32cdf520ee64 to your computer and use it in GitHub Desktop.
Save Schweriner/9f252341bd5a131c82db32cdf520ee64 to your computer and use it in GitHub Desktop.
using the core:icon Viewhelper to differ PDF/IMAGE/OTHERS (example of SfEvent)
<f:for each="{event.files}" as="file">
<li class="mb-1">
<span class="icon text-small">
<f:if condition="{file.originalResource.extension}=='pdf'">
<f:then>
<core:icon identifier="actions-file-pdf" />
</f:then>
<f:else if="{file.originalResource.type}==2">
<core:icon identifier="actions-file-image" />
</f:else>
<f:else>
<core:icon identifier="actions-file" />
</f:else>
</f:if>
</span>
<f:if condition="{file.originalResource.title}">
<f:then>
<a href="{file.originalResource.publicUrl}" target="_blank">{file.originalResource.title}</a>
</f:then>
<f:else>
<a href="{file.originalResource.publicUrl}" target="_blank">{file.originalResource.name}</a>
</f:else>
</f:if>
</li>
</f:for>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment