Content Display

Attachments Widget

Display file attachments for any entity (content, events, products). Supports list and grid layouts with download counts and file type grouping.

List Layout

Vertical list with file details.

Requires an entity with attachments. Shows empty state if none.
Code
<?php echo AttachmentsWidget::widget([ 'entityType' => 'Content', 'entityId' => $model->id, 'layout' => 'list', ]); ?>
Live Demo

Requires an entity with attachments. See content or event pages for live example.

Grid with Grouping

Grid layout grouped by file type.

Code
<?php echo AttachmentsWidget::widget([ 'entityType' => 'Content', 'entityId' => $model->id, 'layout' => 'grid', 'groupByType' => true, ]); ?>
Live Demo

Requires an entity with attachments. See content or event pages for live example.

Configuration Options

OptionTypeDefaultDescription
entityTypestringrequiredEntity class: Content, ContentEvent, Product
entityIdintrequiredEntity ID
layoutstringlistLayout: list, grid
showDownloadCountbooltrueShow download statistics
groupByTypeboolfalseGroup files by type (images, docs, etc.)