-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from Gizra/79-message-alter
Allow altering of message entities.
- Loading branch information
Showing
8 changed files
with
236 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?php | ||
|
||
namespace Drupal\message_subscribe\Subscribers; | ||
|
||
/** | ||
* A delivery candidate implementation. | ||
*/ | ||
class DeliveryCandidate implements DeliveryCandidateInterface { | ||
|
||
/** | ||
* An array of flag IDs that triggered the notification. | ||
* | ||
* @var string[] | ||
*/ | ||
protected $flags; | ||
|
||
/** | ||
* An array of notifier IDs for delivery. | ||
* | ||
* @var string[] | ||
*/ | ||
protected $notifiers; | ||
|
||
/** | ||
* The delivery candidate account ID. | ||
* | ||
* @var int | ||
*/ | ||
protected $uid; | ||
|
||
/** | ||
* Constructs the delivery candidate. | ||
* | ||
* @param string[] $flags | ||
* An array of flag IDs. | ||
* @param string[] $notifiers | ||
* An array of notifier IDs. | ||
* @param int $uid | ||
* The delivery candidate account ID. | ||
*/ | ||
public function __construct(array $flags, array $notifiers, $uid) { | ||
$this->flags = $flags; | ||
$this->notifiers = $notifiers; | ||
$this->uid = $uid; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getFlags() { | ||
return array_unique($this->flags); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function setFlags(array $flag_ids) { | ||
$this->flags = $flag_ids; | ||
return $this; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getNotifiers() { | ||
return array_unique($this->notifiers); | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function setNotifiers(array $notifier_ids) { | ||
$this->notifiers = $notifier_ids; | ||
return $this; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getAccountId() { | ||
return $this->uid; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function setAccountId($uid) { | ||
$this->uid = $uid; | ||
return $this; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
<?php | ||
|
||
namespace Drupal\message_subscribe\Subscribers; | ||
|
||
/** | ||
* Defines a subscription delivery candidate interface. | ||
*/ | ||
interface DeliveryCandidateInterface { | ||
|
||
/** | ||
* Get the flags that triggered the subscription. | ||
* | ||
* @return string[] | ||
* An array of subscription flag IDs that triggered the notification. | ||
*/ | ||
public function getFlags(); | ||
|
||
/** | ||
* Sets the flags. | ||
* | ||
* @param array $flag_ids | ||
* An array of flag IDs. | ||
* | ||
* @return static | ||
* Return the object. | ||
*/ | ||
public function setFlags(array $flag_ids); | ||
|
||
/** | ||
* Get the notifier IDs. | ||
* | ||
* @return string[] | ||
* An array of message notifier plugin IDs. | ||
*/ | ||
public function getNotifiers(); | ||
|
||
/** | ||
* Sets the notifier IDs. | ||
* | ||
* @param string[] $notifier_ids | ||
* An array of notifier IDs. | ||
* | ||
* @return static | ||
* Return the object. | ||
*/ | ||
public function setNotifiers(array $notifier_ids); | ||
|
||
/** | ||
* Gets the account ID of the recipient. | ||
* | ||
* @return int | ||
* The user ID for the delivery. | ||
*/ | ||
public function getAccountId(); | ||
|
||
/** | ||
* Sets the account ID. | ||
* | ||
* @param int $uid | ||
* The account ID of the delivery candidate. | ||
* | ||
* @return static | ||
* Return the object. | ||
*/ | ||
public function setAccountId($uid); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters