Skip to content

Commit bf18d3a

Browse files
committed
BaseItemList: Emit ON_ITEM_ADD event after adding the list item to the list
1 parent 68667fe commit bf18d3a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Common/BaseItemList.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ abstract class BaseItemList extends BaseHtmlElement
1515
{
1616
use BaseFilter;
1717

18+
public const ON_ITEM_ADD = 'item-added';
19+
1820
/** @var array<string, mixed> */
1921
protected $baseAttributes = [
2022
'class' => ['item-list', 'default-layout'],
@@ -63,6 +65,8 @@ protected function assemble(): void
6365
/** @var BaseListItem|BaseTableRowItem $item */
6466
$item = new $itemClass($data, $this);
6567
$this->addHtml($item);
68+
69+
$this->emit(self::ON_ITEM_ADD, [$item, $data]);
6670
}
6771

6872
if ($this->isEmpty()) {

0 commit comments

Comments
 (0)