Skip to content

Commit

Permalink
BaseItemList: Emit ON_ITEM_ADD event after adding the list item to …
Browse files Browse the repository at this point in the history
…the list
  • Loading branch information
raviks789 committed Mar 20, 2024
1 parent 68667fe commit bf18d3a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Common/BaseItemList.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ abstract class BaseItemList extends BaseHtmlElement
{
use BaseFilter;

public const ON_ITEM_ADD = 'item-added';

/** @var array<string, mixed> */
protected $baseAttributes = [
'class' => ['item-list', 'default-layout'],
Expand Down Expand Up @@ -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()) {
Expand Down

0 comments on commit bf18d3a

Please sign in to comment.