media_objects() html()
Media objects (an image beside a heading and text) nested by parent_id, e.g. comment threads.
html()->media_objects($data = [], $extra = [])Опції
| Опція | Значення |
|---|---|
$data | Id => ['img', 'alt', 'link', 'head', 'body' (HTML), 'date', 'parent_id']. |
class, id | Classes; id. |
Приклад
Comment 1 2026-11-14 18:20:00
Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo.Код
$img = 'data:image/svg+xml,' . rawurlencode('<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64"><rect width="64" height="64" fill="#999"/></svg>');
$body = 'Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo.';
return html()->media_objects([
11 => ['link' => '#comment-11', 'img' => $img, 'alt' => '64x64', 'head' => 'Comment 1', 'body' => $body, 'date' => '2026-11-14 18:20'],
22 => ['link' => '#comment-22', 'img' => $img, 'head' => 'Comment 2', 'body' => $body],
33 => ['link' => '#comment-33', 'img' => $img, 'head' => 'A reply', 'body' => $body, 'parent_id' => 22],
44 => ['img' => $img, 'body' => 'A reply to the reply.', 'parent_id' => 33],
]);Bootstrap 3 and 5
Bootstrap 3 media; Bootstrap 5 has no media object: d-flex + flex-shrink-0 markup.
Див. також: html/tree, html/thumbnails