Last active
April 15, 2016 13:19
-
-
Save dpi/034117caad94e50b1cb36ed3a7d53fd9 to your computer and use it in GitHub Desktop.
notifyNeedsReview redux
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
/** | |
* Notify the owner of the Job using courier. | |
*/ | |
private function notifyNeedsReview() { | |
$template_collection_ids = \Drupal::state()->get('tmgmt_notifications_template_collections', []); | |
if (isset($template_collection_ids['job_item_needs_review'])) { | |
$id = $template_collection_ids['job_item_needs_review']; | |
/** @var \Drupal\courier\TemplateCollectionInterface $template_collection */ | |
$template_collection = TemplateCollection::load($id); | |
$template_collection->setTokenValue('tmgmt_job_item', $this); | |
$identity = $this->getJob()->getOwner(); | |
$mqi = \Drupal::service('courier.manager') | |
->sendMessage($template_collection, $identity); | |
if ($mqi instanceof MessageQueueItemInterface) { | |
drupal_set_message(t('Message queued for delivery.')); | |
} | |
else { | |
drupal_set_message(t('Failed to send message'), 'error'); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment