public function SmsMessage::addRecipient in SMS Framework 8
Same name in this branch
- 8 src/Message/SmsMessage.php \Drupal\sms\Message\SmsMessage::addRecipient()
- 8 src/Entity/SmsMessage.php \Drupal\sms\Entity\SmsMessage::addRecipient()
Same name and namespace in other branches
- 2.x src/Entity/SmsMessage.php \Drupal\sms\Entity\SmsMessage::addRecipient()
- 2.1.x src/Entity/SmsMessage.php \Drupal\sms\Entity\SmsMessage::addRecipient()
Adds a single recipient to the SMS message.
Parameters
string $recipient: The recipient to add.
Return value
$this The called SMS message object.
Overrides SmsMessageInterface::addRecipient
1 call to SmsMessage::addRecipient()
- SmsMessage::addRecipients in src/
Entity/ SmsMessage.php - Adds multiple recipients to the SMS message.
File
- src/
Entity/ SmsMessage.php, line 72
Class
- SmsMessage
- Defines the SMS message entity.
Namespace
Drupal\sms\EntityCode
public function addRecipient($recipient) {
// Ensure duplicate recipients cannot be added.
foreach ($this->recipient_phone_number as $item) {
if ($item->value == $recipient) {
return $this;
}
}
$this->recipient_phone_number
->appendItem($recipient);
return $this;
}