Item class
Class presents dialog item.
Constructor
__construct(array $options)
$options
— array with item options. Defined by structure ItemOptions
:
id: string | int
Item ID. Required parameter.
entityId: string
Entity ID. Required parameter.
entityType: string
Entity type.
tabs: string | string[]
Identifier or array with tab IDs, showing the item. When tab binding is not indicated, item still can be found using search.
title: string | TextNodeOptions
Item title. Defined either by string or structure TextNodeOptions.
When value is not indicated, shows item with empty title.Structure
TextNodeOptions
allows to define text content and its type.$textNodeOptions = ['text' => 'content', 'type' => 'content'];
text: string
— text contenttype: 'text' | 'html'
— content type.
subtitle: string | TextNodeOptions
Item subtitle. Defined either by string or structure TextNodeOptions.
When value is not indicated, searches subtitle in the entity settings.supertitle: string | TextNodeOptions
Item supertitle. Defined either by string or structure TextNodeOptions.
When value is not indicated, searches supertitle in the entity settings.caption: string | TextNodeOptions
Item caption. Defined either by string or structure TextNodeOptions.
When value is not indicated, searches caption in the entity settings.captionOptions: array
Item caption additional settings. Defined by array with keys matching the structure CaptionOptions.
When value is not indicated, searches config in the entity settings.avatar: string
Item avatar. Indicates either image path or file in format Data URL.
When value is not indicated, searches avatar in the entity settings.avatarOptions: array
Additional settings for item avatar.
Defined by array with keys matching with structure AvatarOptions.
When value is not indicated, searches config in the entity settings.textColor: string
Text title color.
When value is not indicated, searches text color in the entity settings.link: string
"More" link address.
When value is not indicated, searches link address in the entity settings.linkTitle: string
"More" link title.
When value is not indicated, searches link title in the entity settings.badges: array
Array with item badges. Each badge is defined by array with keys matching with structure ItemBadgeOptions.
When value is not indicated, searches badges in the entity settings.badgesOptions: array
Additional settings for block with badges. Defined by array with keys matching the structure BadgesOptions.
selected: bool
When set as
true
, such item will be added to dialog as selected. Default value:false
.searchable: bool
When set as
false
, such item won't be found in search. Default value:true
.saveable: bool
When set as
false
, such item won't be saved for "Recent" tab. Default value:true
.deselectable: bool
When set as
false
, then such item cannot be deselected. Default value:true
.hidden: bool
Flag, indicating a hidden item.
sort: int
Item sorting index used for sorting items at the "Recent" tab, as well as in search results. Not specified by default.
availableInRecentTab: bool
When set as
false
, item won't be shown at the "Recent" tab.customData: array
Custom additional item data.
nodeOptions: array
Additional settings for item DOM-node. Defined by array with keys matching with structure ItemNodeOptions.
tagOptions: array
Settings for showing item in widget
TagSelector
. Defined by array with keys matching with structure TagOptions.
When value is not indicated, searches config in the entity settings.children: array
Array with child items. Used for creating tree-type structure. Each array item is defined by structure ItemOptions.
Methods
Method | Description | Available from version |
---|---|---|
getId(): string | number | Returns item ID. | |
getEntityId(): string | Returns entity ID. | |
getEntityType(): ?string | Returns entity type. | |
setEntityType(string $type): self | Sets entity type. | |
getTitle(): string | Returns item title. When title is not specified, returns empty string. | |
setTitle($title): self | Sets item title. Title is defined either by string or structure TextNodeOptions. | |
getSubtitle(): ?string | Returns item subtitle. | |
setSubtitle($subtitle): self | Sets item subtitle. Subtitle is defined either by string or structure TextNodeOptions. | |
getSupertitle(): ?string | Returns item supertitle. | |
setSupertitle($supertitle): self | Sets item supertitle. Supertitle is defined either by string or structure TextNodeOptions. | |
getCaption(): ?string | Returns item caption. | |
setCaption($caption): self | Sets item caption. Caption is defined either by string or structure TextNodeOptions. | |
setCaptionOptions(array $captionOptions) | Sets additional settings for item caption.
| |
getCaptionOptions(): Dictionary | Returns collection with item caption config. | |
getAvatar(): ?string | Returns item avatar. | |
setAvatar(?string $avatar): self | Sets item avatar. Indicates either image path or file in format Data URL. | |
getAvatarOptions(): Dictionary | Returns settings for item avatar. | |
setAvatarOptions(array $avatarOptions): self | Sets additional settings for item avatar.
| |
getTextColor(): ?string | Returns title text color. | |
setTextColor(?string $textColor): self | Sets title text color цвет. | |
getLink(): ?string | Returns "More" link title. | |
setLink(?string $link): self | Sets "more" link address. | |
getLinkTitle(): ?string | Returns "more" link title. | |
setLinkTitle($linkTitle): self | Sets "more" link title. Title is defined either by string or structure TextNodeOptions. | |
getBadges(): ?array | Returns array with badges. | |
addBadges(array $badges): self | Adds item badges.
| |
setBadges(array $badges): self | Sets item badges.
| |
setBadgesOptions(array $badgesOptions): self | Sets additional settings for block with badges.
| |
getBadgesOptions(): Dictionary | Returns collection of settings for block with badges. | |
getTabs(): array | Returns array with tab IDs. | |
addTab($tabId): self | Adds item to a tab. | |
getChildren(): ItemCollection | Returns collection of item descendants. | |
addChildren(array $children): self | Adds child items. Each array item is defined by structure ItemOptions. | |
addChild(Item $item): self | Adds a child item (object of class Item ).
| |
setNodeOptions(array $nodeOptions): self | Sets settings for [link=13509304]item DOM-node[/link].
| |
getNodeOptions(): Dictionary | Returns collection of settings for [link=13509304]item DOM-node[/link]. | |
setTagOptions(array $nodeOptions): self | Sets settings for showing item in widget TagSelector .
| |
getTagOptions(): Dictionary | Returns collection of settings for showing item in widget TagSelector .
| |
isSelected(): bool | Returns true when item is selected.
| |
setSelected(bool $flag = true): self | Sets or cancels "selected" status for item. | |
isSearchable(): bool | Returns true when item is searchable.
| |
setSearchable(bool $flag = true): self | Sets or cancels item participation in search. | |
isSaveable(): bool | Returns true when item selection is saves for "Recent" tab.
| |
setSaveable(bool $flag = true): self | Sets or cancels saving of selected item for "Recent" tab. | |
isDeselectable(): bool | Returns true when item can be deselected.
| |
setDeselectable(bool $flag = true): self | Sets or cancels option to deselect an item. | |
isHidden(): bool | Returns true when item is hidden.
| |
setHidden(bool $flag = true): self | Sets or cancels item's "hidden" status. | |
isAvailableInRecentTab(): bool | Returns false when item cannot be shown at the "Recent" tab.
| |
setAvailableInRecentTab(bool $flag = true): self | Sets item visibility at the "Recent" tab. | |
setCustomData(array $customData): self | Sets collection of additional item data. | |
getCustomData(): Dictionary | Returns collection of additional item data. | |
setSort(?int $sort): self | Sets item sorting. | |
getSort(): ?int | Returns item sorting. |