You are here

class EmailActivityDestination in Open Social 8

Same name and namespace in other branches
  1. 8.9 modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php \Drupal\activity_send_email\Plugin\ActivityDestination\EmailActivityDestination
  2. 8.2 modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php \Drupal\activity_send_email\Plugin\ActivityDestination\EmailActivityDestination
  3. 8.3 modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php \Drupal\activity_send_email\Plugin\ActivityDestination\EmailActivityDestination
  4. 8.4 modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php \Drupal\activity_send_email\Plugin\ActivityDestination\EmailActivityDestination
  5. 8.5 modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php \Drupal\activity_send_email\Plugin\ActivityDestination\EmailActivityDestination
  6. 8.6 modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php \Drupal\activity_send_email\Plugin\ActivityDestination\EmailActivityDestination
  7. 8.7 modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php \Drupal\activity_send_email\Plugin\ActivityDestination\EmailActivityDestination
  8. 8.8 modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php \Drupal\activity_send_email\Plugin\ActivityDestination\EmailActivityDestination
  9. 10.3.x modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php \Drupal\activity_send_email\Plugin\ActivityDestination\EmailActivityDestination
  10. 10.0.x modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php \Drupal\activity_send_email\Plugin\ActivityDestination\EmailActivityDestination
  11. 10.1.x modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php \Drupal\activity_send_email\Plugin\ActivityDestination\EmailActivityDestination
  12. 10.2.x modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php \Drupal\activity_send_email\Plugin\ActivityDestination\EmailActivityDestination

Provides a 'EmailActivityDestination' activity destination.

Plugin annotation


@ActivityDestination(
 id = "email",
 label = @Translation("Email"),
 isAggregatable = FALSE,
 isCommon = FALSE,
)

Hierarchy

Expanded class hierarchy of EmailActivityDestination

4 files declare their use of EmailActivityDestination
ActivityDigestWorker.php in modules/custom/activity_send/modules/activity_send_email/src/Plugin/QueueWorker/ActivityDigestWorker.php
ActivitySendEmailWorker.php in modules/custom/activity_send/modules/activity_send_email/src/Plugin/QueueWorker/ActivitySendEmailWorker.php
activity_send_email.module in modules/custom/activity_send/modules/activity_send_email/activity_send_email.module
Contains activity_basics.module..
Immediately.php in modules/custom/activity_send/modules/activity_send_email/src/Plugin/EmailFrequency/Immediately.php

File

modules/custom/activity_send/modules/activity_send_email/src/Plugin/ActivityDestination/EmailActivityDestination.php, line 18

Namespace

Drupal\activity_send_email\Plugin\ActivityDestination
View source
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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ActivityDestinationBase::getViewMode public function Returns a view mode for the entity. Overrides ActivityDestinationInterface::getViewMode
ActivityDestinationBase::isActiveInView public function True or false if the activity destination is set. Overrides ActivityDestinationInterface::isActiveInView
EmailActivityDestination::getSendEmailMessageTemplates public static function
EmailActivityDestination::getSendEmailOutputText public static function Get field value for 'output_text' field from data array.
EmailActivityDestination::getSendEmailUserSettings public static function
EmailActivityDestination::setSendEmailUserSettings public static function
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.
PluginBase::__construct public function Constructs a \Drupal\Component\Plugin\PluginBase object. 92
SendActivityDestinationBase::getSendMessageTemplates public static function Returns message templates for which given destination is enabled.
SendActivityDestinationBase::getSendTargetUser public static function Returns target account.
SendActivityDestinationBase::getSendUserSettings public static function Returns notification settings of given user.
SendActivityDestinationBase::isUserOffline public static function Check if user last activity was more than few minutes ago.
SendActivityDestinationBase::setSendUserSettings public static function Set notification settings for given user.