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

object
build(bool $executeInUserContext = true)

Build Message

bool
buildAndPublish()

Build in User Context and Create Notification Job for Notification Message

create()

No description

setCTAUrl(string $CTAUrl)

Provide a CallToAction URL for this user to be redirected to the source of the event.

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

setHtmlI18nToken(I18nTokenHelper $I18nTokenHelper)

Provide a I18nTokenHelper

setIconCSSClass(string $iconCSSClass)

No description

setNotificationRegistryKey(string $key)

Set the config key of your notification. If you are not setting this key, the first configured notifcation will be selected.

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

setPlaintextByCallback(callable $callback) deprecated

Provide a callback/closure which is providing the plaintext body for your notification

setPlaintextI18nToken(I18nTokenHelper $I18nTokenHelper)

Provide a I18nTokenHelper

setRecipientUserId(string $userId)

Who should receive this notification?

setSourceInstance(string|int $instance)

Set instance reference as string or int

setStatus(string $status)

No description

setSubjectAndBodyAsVarsTemplate(VarsTemplate $varsTemplate)

You can use a varsTemplate to provide Subject, Plaintext and HTML as Template Object

setSubjectAndBodyAsVarsTemplateAsCallback(callable $varsTemplateCB)

You can use a varsTemplate to provide Subject, Plaintext and HTML as Template Object

setSubjectAsCallback(callable $callback) deprecated

Provide a callback/closure which is providing the subject for your notification

setSubjectAsString(string $subject, string|null $fakeTranslateString = null)

Provide the subject as translateable string Example: ->setSubjectAsString("New like", _("New like"))

setSubjectI18nToken(I18nTokenHelper $I18nTokenHelper)

Provide a I18nTokenHelper

setToken(string $token)

Set the token which identifies your notification within your context A preferred syntax would be 'TYPE:'

setType(string $type)

todo doc, defaults

Details

at line 364
object build(bool $executeInUserContext = true)

Build Message

Parameters

bool $executeInUserContext

Return Value

object

at line 524
bool buildAndPublish()

Build in User Context and Create Notification Job for Notification Message

Return Value

bool Success

at line 85
static BuilderInterface create()

No description

Return Value

BuilderInterface

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

Parameters

string $CTAUrl /goto/_doc

Return Value

NotificationBuilder

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

Parameters

DocumentIndex $documentIndex

Return Value

NotificationBuilder

at line 221
NotificationBuilder setHtmlI18nToken(I18nTokenHelper $I18nTokenHelper)

Provide a I18nTokenHelper

Parameters

I18nTokenHelper $I18nTokenHelper

Return Value

NotificationBuilder

at line 119
NotificationBuilder setIconCSSClass(string $iconCSSClass)

No description

Parameters

string $iconCSSClass

e.g. icon-warning-sign

Return Value

NotificationBuilder

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.

Parameters

string $key

(e.g. likes)

Return Value

NotificationBuilder

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

Parameters

string $plaintext
string|null $fakeTranslateString

Return Value

NotificationBuilder

at line 249
NotificationBuilder setPlaintextByCallback(callable $callback) deprecated

deprecated Please use Token instead

Provide a callback/closure which is providing the plaintext body for your notification

Parameters

callable $callback

Return Value

NotificationBuilder

at line 261
NotificationBuilder setPlaintextI18nToken(I18nTokenHelper $I18nTokenHelper)

Provide a I18nTokenHelper

Parameters

I18nTokenHelper $I18nTokenHelper

Return Value

NotificationBuilder

at line 296
NotificationBuilder setRecipientUserId(string $userId)

Who should receive this notification?

Parameters

string $userId

Return Value

NotificationBuilder

at line 308
NotificationBuilder setSourceInstance(string|int $instance)

Set instance reference as string or int

Parameters

string|int $instance

Return Value

NotificationBuilder

at line 272
NotificationBuilder setStatus(string $status)

No description

Parameters

string $status

Return Value

NotificationBuilder

at line 157
NotificationBuilder setSubjectAndBodyAsVarsTemplate(VarsTemplate $varsTemplate)

You can use a varsTemplate to provide Subject, Plaintext and HTML as Template Object

Parameters

VarsTemplate $varsTemplate

Return Value

NotificationBuilder

at line 169
NotificationBuilder setSubjectAndBodyAsVarsTemplateAsCallback(callable $varsTemplateCB)

You can use a varsTemplate to provide Subject, Plaintext and HTML as Template Object

Parameters

callable $varsTemplateCB

Return Value

NotificationBuilder

at line 196
NotificationBuilder setSubjectAsCallback(callable $callback) deprecated

deprecated Please use Token instead

Provide a callback/closure which is providing the subject for your notification

Parameters

callable $callback

Return Value

NotificationBuilder

at line 183
NotificationBuilder setSubjectAsString(string $subject, string|null $fakeTranslateString = null)

Provide the subject as translateable string Example: ->setSubjectAsString("New like", _("New like"))

Parameters

string $subject
string|null $fakeTranslateString
  • This param is provided as convenience to supply a string for the translation tool

Return Value

NotificationBuilder

at line 208
NotificationBuilder setSubjectI18nToken(I18nTokenHelper $I18nTokenHelper)

Provide a I18nTokenHelper

Parameters

I18nTokenHelper $I18nTokenHelper

Return Value

NotificationBuilder

at line 109
NotificationBuilder setToken(string $token)

Set the token which identifies your notification within your context A preferred syntax would be 'TYPE:'

Parameters

string $token

Return Value

NotificationBuilder

at line 284
NotificationBuilder setType(string $type)

todo doc, defaults

Parameters

string $type

Return Value

NotificationBuilder