From bf18d3ac049c3b1a6e4b2269ee71771546f2d37d Mon Sep 17 00:00:00 2001 From: raviks789 Date: Wed, 20 Mar 2024 15:27:12 +0100 Subject: [PATCH] BaseItemList: Emit `ON_ITEM_ADD` event after adding the list item to the list --- src/Common/BaseItemList.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Common/BaseItemList.php b/src/Common/BaseItemList.php index ce0946c8..b349f426 100644 --- a/src/Common/BaseItemList.php +++ b/src/Common/BaseItemList.php @@ -15,6 +15,8 @@ abstract class BaseItemList extends BaseHtmlElement { use BaseFilter; + public const ON_ITEM_ADD = 'item-added'; + /** @var array */ protected $baseAttributes = [ 'class' => ['item-list', 'default-layout'], @@ -63,6 +65,8 @@ protected function assemble(): void /** @var BaseListItem|BaseTableRowItem $item */ $item = new $itemClass($data, $this); $this->addHtml($item); + + $this->emit(self::ON_ITEM_ADD, [$item, $data]); } if ($this->isEmpty()) {