{% set handled = false %}
{% for block in handle_event('ViewAttachment', {'attachment': attachment, 'note': note, 'title': title}) %}
    {% set handled = true %}
    <div class="note-attachments-unit">
        {{ block | raw }}
    </div>
{% endfor %}
{% if not handled %}
    <div class="note-attachments-unit">
        {% if attachment.getFilename() is not null %}
            <a href="{{ attachment.getShowUrl(note) }}">{{ title }}</a>
        {% else %}
            {{ title }}
        {% endif %}
    </div>
{% endif %}
