Loading modules/custom/activity_creator/activity_creator.tokens.inc +3 −2 Changes for modules/custom/activity_creator/activity_creator.tokens.inc: 3 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ */ use Drupal\Core\Render\BubbleableMetadata; use Drupal\message\Entity\Message; use Drupal\user\UserInterface; /** Loading Loading @@ -41,11 +42,10 @@ function activity_creator_tokens($type, $tokens, array $data, array $options, Bu /** @var \Drupal\message\Entity\Message $message */ $message = $data['message']; if ($message instanceof Message) { foreach ($tokens as $name => $original) { switch ($name) { case 'field_activity_recipient_user_display_name': // Get the targeted user and its display name. if ($name === 'field_activity_recipient_user_display_name') { if (!$message->get('field_message_related_object')->isEmpty()) { Loading Loading @@ -74,6 +74,7 @@ function activity_creator_tokens($type, $tokens, array $data, array $options, Bu } } } } return $replacements; } modules/custom/activity_logger/activity_logger.tokens.inc +5 −4 Changes for modules/custom/activity_logger/activity_logger.tokens.inc: 5 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ use Drupal\Core\Render\BubbleableMetadata; use Drupal\Core\Url; use Drupal\group\Entity\Group; use Drupal\group\Entity\GroupContent; use Drupal\message\Entity\Message; use Drupal\node\Entity\Node; use Drupal\Core\Language\LanguageInterface; Loading Loading @@ -70,6 +71,7 @@ function activity_logger_tokens($type, $tokens, array $data, array $options, Bub /** @var \Drupal\message\Entity\Message $message */ $message = $data['message']; if ($message instanceof Message) { $token_service = \Drupal::token(); foreach ($tokens as $name => $original) { Loading Loading @@ -165,16 +167,14 @@ function activity_logger_tokens($type, $tokens, array $data, array $options, Bub if ($name === 'recipient-user') { if (!empty($recipient_user)) { $account = &$recipient_user; } else { } else { $account = \Drupal::entityTypeManager()->getStorage('user') ->load(0); } /** @var \Drupal\user\UserInterface $account */ $replacements[$original] = $account->getDisplayName(); } elseif ($name === 'recipient-user-url') { } elseif ($name === 'recipient-user-url') { if (!empty($recipient_user)) { $target_stream_url = Url::fromRoute('entity.user.canonical', ['user' => $recipient_user->id()], Loading Loading @@ -220,6 +220,7 @@ function activity_logger_tokens($type, $tokens, array $data, array $options, Bub $replacements += $token_service->generate('user', $recipient_user_tokens, ['user' => $recipient_user], $options, $bubbleable_metadata); } } } return $replacements; } modules/custom/social_queue_storage/social_queue_storage.tokens.inc +3 −0 Changes for modules/custom/social_queue_storage/social_queue_storage.tokens.inc: 3 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ */ use Drupal\Core\Render\BubbleableMetadata; use Drupal\message\Entity\Message; /** * Implements hook_token_info(). Loading Loading @@ -39,6 +40,7 @@ function social_queue_storage_tokens($type, $tokens, array $data, array $options /** @var \Drupal\message\Entity\Message $message */ $message = $data['message']; if ($message instanceof Message) { foreach ($tokens as $name => $original) { if ($name === 'mail_task_subject' && $message->getFieldValue('field_message_related_object', 'target_type') === 'queue_storage_entity') { // Get the target storage entity and get the subject. Loading @@ -56,6 +58,7 @@ function social_queue_storage_tokens($type, $tokens, array $data, array $options } } } } return $replacements; } modules/social_features/social_activity/social_activity.tokens.inc +7 −1 Changes for modules/social_features/social_activity/social_activity.tokens.inc: 7 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ use Drupal\Core\Render\BubbleableMetadata; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\group\Entity\GroupContentInterface; use Drupal\message\Entity\Message; use Drupal\node\NodeInterface; /** Loading Loading @@ -52,7 +53,12 @@ function social_activity_tokens($type, $tokens, array $data, array $options, Bub if ($type === 'message' && !empty($data['message'])) { /** @var \Drupal\message\Entity\Message $message */ $message = $data['message']; if ($message->hasField('field_message_related_object') && !$message->get('field_message_related_object')->isEmpty()) { if ( ($message instanceof Message) && $message->hasField('field_message_related_object') && !$message->get('field_message_related_object')->isEmpty() ) { /** @var \Drupal\social_activity\EmailTokenServices $email_token_services */ $email_token_services = \Drupal::service('social_activity.email_token_services'); Loading modules/social_features/social_comment/social_comment.tokens.inc +7 −2 Changes for modules/social_features/social_comment/social_comment.tokens.inc: 7 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ use Drupal\Core\Render\BubbleableMetadata; use Drupal\Core\Render\Markup; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\Core\Url; use Drupal\message\Entity\Message; use Drupal\node\NodeInterface; use Drupal\social_post\Entity\PostInterface; use Drupal\views\Plugin\views\field\FieldPluginBase; Loading Loading @@ -92,6 +93,7 @@ function social_comment_tokens($type, $tokens, array $data, array $options, Bubb /** @var \Drupal\message\Entity\Message $message */ $message = $data['message']; if ($message instanceof Message) { foreach ($tokens as $name => $original) { switch ($name) { Loading Loading @@ -171,7 +173,8 @@ function social_comment_tokens($type, $tokens, array $data, array $options, Bubb $replacements[$original] = $entity->toUrl('canonical', ['absolute' => TRUE])->toString(); } else { // For comments however it should go to comment reply page. // For comments however it should go to comment reply // page. $replacements[$original] = Url::fromRoute('comment.reply', [ 'entity_type' => $comment->getCommentedEntityTypeId(), 'entity' => $comment->getCommentedEntityId(), Loading Loading @@ -228,7 +231,8 @@ function social_comment_tokens($type, $tokens, array $data, array $options, Bubb $url_options = ['absolute' => TRUE]; $link = $entity->toUrl('canonical', $url_options)->toString(); // We should only use the label of entities who have a label. // We should only use the label of entities who have a // label. if ($link_label = $entity->label()) { $entity_link_html = $commented_content_type . ' <a href="' . $link . '">' . $link_label . '</a>'; } Loading @@ -246,6 +250,7 @@ function social_comment_tokens($type, $tokens, array $data, array $options, Bubb } } } } return $replacements; } Loading Loading
modules/custom/activity_creator/activity_creator.tokens.inc +3 −2 Changes for modules/custom/activity_creator/activity_creator.tokens.inc: 3 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ */ use Drupal\Core\Render\BubbleableMetadata; use Drupal\message\Entity\Message; use Drupal\user\UserInterface; /** Loading Loading @@ -41,11 +42,10 @@ function activity_creator_tokens($type, $tokens, array $data, array $options, Bu /** @var \Drupal\message\Entity\Message $message */ $message = $data['message']; if ($message instanceof Message) { foreach ($tokens as $name => $original) { switch ($name) { case 'field_activity_recipient_user_display_name': // Get the targeted user and its display name. if ($name === 'field_activity_recipient_user_display_name') { if (!$message->get('field_message_related_object')->isEmpty()) { Loading Loading @@ -74,6 +74,7 @@ function activity_creator_tokens($type, $tokens, array $data, array $options, Bu } } } } return $replacements; }
modules/custom/activity_logger/activity_logger.tokens.inc +5 −4 Changes for modules/custom/activity_logger/activity_logger.tokens.inc: 5 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ use Drupal\Core\Render\BubbleableMetadata; use Drupal\Core\Url; use Drupal\group\Entity\Group; use Drupal\group\Entity\GroupContent; use Drupal\message\Entity\Message; use Drupal\node\Entity\Node; use Drupal\Core\Language\LanguageInterface; Loading Loading @@ -70,6 +71,7 @@ function activity_logger_tokens($type, $tokens, array $data, array $options, Bub /** @var \Drupal\message\Entity\Message $message */ $message = $data['message']; if ($message instanceof Message) { $token_service = \Drupal::token(); foreach ($tokens as $name => $original) { Loading Loading @@ -165,16 +167,14 @@ function activity_logger_tokens($type, $tokens, array $data, array $options, Bub if ($name === 'recipient-user') { if (!empty($recipient_user)) { $account = &$recipient_user; } else { } else { $account = \Drupal::entityTypeManager()->getStorage('user') ->load(0); } /** @var \Drupal\user\UserInterface $account */ $replacements[$original] = $account->getDisplayName(); } elseif ($name === 'recipient-user-url') { } elseif ($name === 'recipient-user-url') { if (!empty($recipient_user)) { $target_stream_url = Url::fromRoute('entity.user.canonical', ['user' => $recipient_user->id()], Loading Loading @@ -220,6 +220,7 @@ function activity_logger_tokens($type, $tokens, array $data, array $options, Bub $replacements += $token_service->generate('user', $recipient_user_tokens, ['user' => $recipient_user], $options, $bubbleable_metadata); } } } return $replacements; }
modules/custom/social_queue_storage/social_queue_storage.tokens.inc +3 −0 Changes for modules/custom/social_queue_storage/social_queue_storage.tokens.inc: 3 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ */ use Drupal\Core\Render\BubbleableMetadata; use Drupal\message\Entity\Message; /** * Implements hook_token_info(). Loading Loading @@ -39,6 +40,7 @@ function social_queue_storage_tokens($type, $tokens, array $data, array $options /** @var \Drupal\message\Entity\Message $message */ $message = $data['message']; if ($message instanceof Message) { foreach ($tokens as $name => $original) { if ($name === 'mail_task_subject' && $message->getFieldValue('field_message_related_object', 'target_type') === 'queue_storage_entity') { // Get the target storage entity and get the subject. Loading @@ -56,6 +58,7 @@ function social_queue_storage_tokens($type, $tokens, array $data, array $options } } } } return $replacements; }
modules/social_features/social_activity/social_activity.tokens.inc +7 −1 Changes for modules/social_features/social_activity/social_activity.tokens.inc: 7 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ use Drupal\Core\Render\BubbleableMetadata; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\group\Entity\GroupContentInterface; use Drupal\message\Entity\Message; use Drupal\node\NodeInterface; /** Loading Loading @@ -52,7 +53,12 @@ function social_activity_tokens($type, $tokens, array $data, array $options, Bub if ($type === 'message' && !empty($data['message'])) { /** @var \Drupal\message\Entity\Message $message */ $message = $data['message']; if ($message->hasField('field_message_related_object') && !$message->get('field_message_related_object')->isEmpty()) { if ( ($message instanceof Message) && $message->hasField('field_message_related_object') && !$message->get('field_message_related_object')->isEmpty() ) { /** @var \Drupal\social_activity\EmailTokenServices $email_token_services */ $email_token_services = \Drupal::service('social_activity.email_token_services'); Loading
modules/social_features/social_comment/social_comment.tokens.inc +7 −2 Changes for modules/social_features/social_comment/social_comment.tokens.inc: 7 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -10,6 +10,7 @@ use Drupal\Core\Render\BubbleableMetadata; use Drupal\Core\Render\Markup; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\Core\Url; use Drupal\message\Entity\Message; use Drupal\node\NodeInterface; use Drupal\social_post\Entity\PostInterface; use Drupal\views\Plugin\views\field\FieldPluginBase; Loading Loading @@ -92,6 +93,7 @@ function social_comment_tokens($type, $tokens, array $data, array $options, Bubb /** @var \Drupal\message\Entity\Message $message */ $message = $data['message']; if ($message instanceof Message) { foreach ($tokens as $name => $original) { switch ($name) { Loading Loading @@ -171,7 +173,8 @@ function social_comment_tokens($type, $tokens, array $data, array $options, Bubb $replacements[$original] = $entity->toUrl('canonical', ['absolute' => TRUE])->toString(); } else { // For comments however it should go to comment reply page. // For comments however it should go to comment reply // page. $replacements[$original] = Url::fromRoute('comment.reply', [ 'entity_type' => $comment->getCommentedEntityTypeId(), 'entity' => $comment->getCommentedEntityId(), Loading Loading @@ -228,7 +231,8 @@ function social_comment_tokens($type, $tokens, array $data, array $options, Bubb $url_options = ['absolute' => TRUE]; $link = $entity->toUrl('canonical', $url_options)->toString(); // We should only use the label of entities who have a label. // We should only use the label of entities who have a // label. if ($link_label = $entity->label()) { $entity_link_html = $commented_content_type . ' <a href="' . $link . '">' . $link_label . '</a>'; } Loading @@ -246,6 +250,7 @@ function social_comment_tokens($type, $tokens, array $data, array $options, Bubb } } } } return $replacements; } Loading