Documentation

ItemCollection class

Class represents collection of dialog items.

Object of collection is created automatically and is available in data provider via the method $dialog->getItemCollection().

For adding items to dialog, use methods $dialog->addItem() or $dialog->addItems() of class Dialog.

Also this collection is returned by static methods Dialog::getItems and Dialog::getSelectedItems.

Method Description Available from version
add(Item $item): bool Adds item (object of class Item) to collection.
Use the methods to add items in data provider: $dialog->addItem() or $dialog->addItems().
get(string $entityId, string|int $itemId): ?Item Returns a collection item by specified entity and item IDs.
has(Item $item): bool Returns true when specified item is available in the collection.
getAll(): array Returns array for all items.
count(): int Returns number of collection items.
getEntityItems(string $entityId): array Returns array with items of specified entity.
toJsObject(): string Returns JavaScript representation for collection. Can be used for passing collection data from PHP to JavaScript.
toArray(): array Returns collection items as a data array.

© «Bitrix24», 2001-2024
Up