EmailActivityDestination.php in Open Social 8
Same filename and directory in other branches
- 8.9 modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php
- 8.2 modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php
- 8.3 modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php
- 8.4 modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php
- 8.5 modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php
- 8.6 modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php
- 8.7 modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php
- 8.8 modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php
- 10.3.x modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php
- 10.0.x modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php
- 10.1.x modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php
- 10.2.x modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php
File
modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.phpView source
<?php
namespace Drupal\activity_send_email\Plugin\ActivityDestination;
use Drupal\activity_send\Plugin\SendActivityDestinationBase;
use Drupal\message\Entity\Message;
/**
* Provides a 'EmailActivityDestination' activity destination.
*
* @ActivityDestination(
* id = "email",
* label = @Translation("Email"),
* isAggregatable = FALSE,
* isCommon = FALSE,
* )
*/
class EmailActivityDestination extends SendActivityDestinationBase {
/**
* {@inheritdoc}
*/
public static function getSendEmailMessageTemplates() {
return parent::getSendMessageTemplates('email');
}
/**
* {@inheritdoc}
*/
public static function getSendEmailUserSettings($account) {
return parent::getSendUserSettings('email', $account);
}
/**
* {@inheritdoc}
*/
public static function setSendEmailUserSettings($account, $values) {
parent::setSendUserSettings('email', $account, $values);
}
/**
* Get field value for 'output_text' field from data array.
*
* @param \Drupal\message\Entity\Message $message
* The Message object.
* @param string $langcode
* The language in which we need to get the email text.
*
* @return string|null
* If we have message text we return the text, otherwise null.
*/
public static function getSendEmailOutputText(Message $message, $langcode = '') {
$text = NULL;
if (isset($message)) {
$activity_factory = \Drupal::service('activity_creator.activity_factory');
$value = $activity_factory
->getMessageText($message, $langcode);
// Text for email.
if (!empty($value[2])) {
$text = $value[2];
}
else {
$text = $value[0];
}
}
return $text;
}
}
Classes
Name | Description |
---|---|
EmailActivityDestination | Provides a 'EmailActivityDestination' activity destination. |