Widget Demos
UI Components
Marketing
Content Display
Navigation
Notifications
Visual Effects
Interactive
Layout
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
| Option | Type | Default | Description |
|---|---|---|---|
entityType | string | required | Entity class: Content, ContentEvent, Product |
entityId | int | required | Entity ID |
layout | string | list | Layout: list, grid |
showDownloadCount | bool | true | Show download statistics |
groupByType | bool | false | Group files by type (images, docs, etc.) |