MediaWiki master
MediaWiki\Notification\Notification Class Reference

Inherited by MediaWiki\Notification\Types\SimpleNotification, MediaWiki\Notification\Types\WikiNotification, and MediaWiki\User\WelcomeNotification.

Public Member Functions

 __construct (string $type, array $custom=[])
 Base for Notifications.
 
 getProperties ()
 Retrieve Notification properties.
 
 getType ()
 Get the Notification type.
 
 setProperty (string $key, $value)
 Sets a custom property to the notification.
 

Protected Attributes

string string $type
 

Detailed Description

Stability: newable
Stability: stable
to extend
Since
1.45

Definition at line 13 of file Notification.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Notification\Notification::__construct ( string $type,
array $custom = [] )

Base for Notifications.

Type is the only required property, and any additional data can be passed via $custom array.

See also
WikiNotification in case you want a Notification with Agent and Title
Parameters
string$typeNotification type
(scalar|array|null|JsonCodecable)[]$custom Custom notification data, see setProperty() for more details about the allowed keys and values

Definition at line 44 of file Notification.php.

References MediaWiki\Notification\Notification\$type.

Member Function Documentation

◆ getProperties()

MediaWiki\Notification\Notification::getProperties ( )

Retrieve Notification properties.

Definition at line 73 of file Notification.php.

◆ getType()

MediaWiki\Notification\Notification::getType ( )

Get the Notification type.

Definition at line 52 of file Notification.php.

◆ setProperty()

MediaWiki\Notification\Notification::setProperty ( string $key,
$value )

Sets a custom property to the notification.

Any other keys may be used to pass additional data handled by specific extensions.* The value of keys other than those listed above should be (de)serializable as JSON, by either being scalar or array containing scalar values or using the JsonCodecable interface.

Parameters
string$key
scalar | array | JsonCodecable$value

Definition at line 66 of file Notification.php.

Member Data Documentation

◆ $type

string string MediaWiki\Notification\Notification::$type
protected
Todo
Idea: handle future types in format namespace.type, like mediawiki.message, growth.welcome. This way we can easily "override" some notifications, for example, we can have echo.mention, and the echo.mention could supersede mediawiki.mention. Also, it will be more difficult for notifications to conflict, and we will be able to easily filter apply logic depends on the namespace (for example, hide if extension not present).

Required, Read-only - The Notification type

Definition at line 26 of file Notification.php.

Referenced by MediaWiki\Notification\Notification\__construct(), and MediaWiki\Notification\Types\WikiNotification\__construct().


The documentation for this class was generated from the following file: