CoolCMS API

MessagePickerTrait

Discussion message picker: self-reference (the parent message in the tree).

The trait carries the manager itself (#[Inject]), so the presenter must not take it in its constructor; otherwise the property collides with a private readonly constructor parameter. The grid data source and the form read $this->messageManager from this trait.

Table of Contents

Properties

$messageManager  : MessageManager

Methods

messagePicker()  : PickerConfig
messageLabel()  : string
resolveMessageLabel()  : string|null
Returns the label for prefilling the edit form (from the hidden value).
suggestMessages()  : array<int, array{id: int, label: string}>
Suggests messages by a `LIKE` match on the subject, optionally without the excluded node and its whole subtree (a message must not become the parent of itself or its descendant).

Properties

Methods

messagePicker()

protected messagePicker(string $formName, string $targetField[, int|null $excludeId = null ][, int|null $excludeSubtreeLft = null ][, int|null $excludeSubtreeRgt = null ]) : PickerConfig
Parameters
$formName : string

name of the form with the hidden field (editForm)

$targetField : string

name of the hidden control (parentId)

$excludeId : int|null = null

id that must not be selected (self-reference)

$excludeSubtreeLft : int|null = null

lft of the edited node (excludes the whole subtree)

$excludeSubtreeRgt : int|null = null

rgt of the edited node (excludes the whole subtree)

Return values
PickerConfig

resolveMessageLabel()

Returns the label for prefilling the edit form (from the hidden value).

private resolveMessageLabel(int $id) : string|null
Parameters
$id : int
Return values
string|null

suggestMessages()

Suggests messages by a `LIKE` match on the subject, optionally without the excluded node and its whole subtree (a message must not become the parent of itself or its descendant).

private suggestMessages(string $query[, int|null $excludeId = null ][, int|null $excludeSubtreeLft = null ][, int|null $excludeSubtreeRgt = null ]) : array<int, array{id: int, label: string}>
Parameters
$query : string
$excludeId : int|null = null
$excludeSubtreeLft : int|null = null
$excludeSubtreeRgt : int|null = null
Return values
array<int, array{id: int, label: string}>
On this page

Search results