NotificationBuilder
class NotificationBuilder implements BuilderInterface
Class NotificationBuilder
Properties
| protected string | $token | ||
| protected string | $icon | ||
| protected string | $CTAUrl | ||
| protected string | $status | ||
| protected string | $type | ||
| protected string | $userId | ||
| protected string|int | $instanceId | ||
| protected callable|Template | $subjectCallback | ||
| protected I18nTokenHelper|null | $subjectToken | ||
| protected callable | $plaintextCallback | ||
| protected I18nTokenHelper|null | $plainTextToken | ||
| protected I18nTokenHelper|null | $htmlToken | ||
| protected VarsTemplate|callable | $varsTemplate | ||
| protected DocumentIndex|null | $documentIndex | ||
| protected string | $notificationRegistryKey |
Methods
Build Message
Build in User Context and Create Notification Job for Notification Message
No description
Provide a CallToAction URL for this user to be redirected to the source of the event.
Is this notification related to a document? You can provide the DocumentIndex, which will automatically set CTAUrl, Default Title and Token for your Notification
No description
Set the config key of your notification. If you are not setting this key, the first configured notifcation will be selected.
Set Plaintext Body Message for your notification. Please provide an untranslated string which is translateable during build If no plaintext is given, but html is available, the builder will automatically convert the html version to plaintext
Provide a callback/closure which is providing the plaintext body for your notification
Who should receive this notification?
Set instance reference as string or int
No description
You can use a varsTemplate to provide Subject, Plaintext and HTML as Template Object
You can use a varsTemplate to provide Subject, Plaintext and HTML as Template Object
Provide a callback/closure which is providing the subject for your notification
Provide the subject as translateable string Example: ->setSubjectAsString("New like", _("New like"))
Set the token which identifies your notification within your context
A preferred syntax would be 'TYPE:
todo doc, defaults
Details
at line 364
object
build(bool $executeInUserContext = true)
Build Message
at line 524
bool
buildAndPublish()
Build in User Context and Create Notification Job for Notification Message
at line 85
static BuilderInterface
create()
No description
at line 132
NotificationBuilder
setCTAUrl(string $CTAUrl)
Provide a CallToAction URL for this user to be redirected to the source of the event.
The URL should be a relative path whenever possible
at line 145
NotificationBuilder
setDocumentIndex(DocumentIndex $documentIndex)
Is this notification related to a document? You can provide the DocumentIndex, which will automatically set CTAUrl, Default Title and Token for your Notification
at line 221
NotificationBuilder
setHtmlI18nToken(I18nTokenHelper $I18nTokenHelper)
Provide a I18nTokenHelper
at line 119
NotificationBuilder
setIconCSSClass(string $iconCSSClass)
No description
at line 321
NotificationBuilder
setNotificationRegistryKey(string $key)
Set the config key of your notification. If you are not setting this key, the first configured notifcation will be selected.
at line 236
NotificationBuilder
setPlaintext(string $plaintext, string|null $fakeTranslateString = null)
Set Plaintext Body Message for your notification. Please provide an untranslated string which is translateable during build If no plaintext is given, but html is available, the builder will automatically convert the html version to plaintext
at line 249
NotificationBuilder
setPlaintextByCallback(callable $callback)
deprecated
deprecated
Provide a callback/closure which is providing the plaintext body for your notification
at line 261
NotificationBuilder
setPlaintextI18nToken(I18nTokenHelper $I18nTokenHelper)
Provide a I18nTokenHelper
at line 296
NotificationBuilder
setRecipientUserId(string $userId)
Who should receive this notification?
at line 308
NotificationBuilder
setSourceInstance(string|int $instance)
Set instance reference as string or int
at line 272
NotificationBuilder
setStatus(string $status)
No description
at line 157
NotificationBuilder
setSubjectAndBodyAsVarsTemplate(VarsTemplate $varsTemplate)
You can use a varsTemplate to provide Subject, Plaintext and HTML as Template Object
at line 169
NotificationBuilder
setSubjectAndBodyAsVarsTemplateAsCallback(callable $varsTemplateCB)
You can use a varsTemplate to provide Subject, Plaintext and HTML as Template Object
at line 196
NotificationBuilder
setSubjectAsCallback(callable $callback)
deprecated
deprecated
Provide a callback/closure which is providing the subject for your notification
at line 183
NotificationBuilder
setSubjectAsString(string $subject, string|null $fakeTranslateString = null)
Provide the subject as translateable string Example: ->setSubjectAsString("New like", _("New like"))
at line 208
NotificationBuilder
setSubjectI18nToken(I18nTokenHelper $I18nTokenHelper)
Provide a I18nTokenHelper
at line 109
NotificationBuilder
setToken(string $token)
Set the token which identifies your notification within your context
A preferred syntax would be 'TYPE:
at line 284
NotificationBuilder
setType(string $type)
todo doc, defaults