FormTrait
Form for adding a comment to the thread of the expanded work item.
approved: false in the Api response is not an error: the comment only waits for approval
(global comment.useAutoApproval) and an informational message is shown.
Table of Contents
Constants
- ERROR_MESSAGE_KEYS : array<string|int, mixed> = [2 => 'comments.form.messages.errors.validation...
- `code` of the Api response (`mixed` because of `ReflectionException`) mapped to the translated message key.
Methods
- onCommentFormSuccess() : void
- createComponentCommentForm() : Form
- resolveMessageKey() : string
- An unknown or missing code gives the generic message.
- str() : string
- `ArrayHash` values are `mixed`; safely narrows to string (a non-string becomes empty).
Constants
ERROR_MESSAGE_KEYS
`code` of the Api response (`mixed` because of `ReflectionException`) mapped to the translated message key.
private
array<string|int, mixed>
ERROR_MESSAGE_KEYS
= [2 => 'comments.form.messages.errors.validationFailed', 404 => 'comments.form.messages.errors.rateLimitExceeded']
Methods
onCommentFormSuccess()
public
onCommentFormSuccess(Form $form, ArrayHash $values) : void
Parameters
- $form : Form
- $values : ArrayHash
createComponentCommentForm()
protected
createComponentCommentForm() : Form
Return values
FormresolveMessageKey()
An unknown or missing code gives the generic message.
private
static resolveMessageKey(bool $success, bool $approved, mixed $code) : string
Parameters
- $success : bool
- $approved : bool
- $code : mixed
Return values
stringstr()
`ArrayHash` values are `mixed`; safely narrows to string (a non-string becomes empty).
private
static str(mixed $value) : string
Parameters
- $value : mixed