File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,11 @@ abstract class BaseItemList extends BaseHtmlElement
15
15
{
16
16
use BaseFilter;
17
17
18
+ /** @var string Emitted while assembling the list after adding each list item */
19
+ public const ON_ITEM_ADD = 'item-added ' ;
20
+
21
+ public const BEFORE_ITEM_ADD = 'before-item-add ' ;
22
+
18
23
/** @var array<string, mixed> */
19
24
protected $ baseAttributes = [
20
25
'class ' => ['item-list ' , 'default-layout ' ],
@@ -62,7 +67,9 @@ protected function assemble(): void
62
67
foreach ($ this ->data as $ data ) {
63
68
/** @var BaseListItem|BaseTableRowItem $item */
64
69
$ item = new $ itemClass ($ data , $ this );
70
+ $ this ->emit (self ::BEFORE_ITEM_ADD , [$ item , $ data ]);
65
71
$ this ->addHtml ($ item );
72
+ $ this ->emit (self ::ON_ITEM_ADD , [$ item , $ data ]);
66
73
}
67
74
68
75
if ($ this ->isEmpty ()) {
You can’t perform that action at this time.
0 commit comments