public function PrivateMessageService::getThreadForMembers in Private Message 8.2
Same name and namespace in other branches
- 8 src/Service/PrivateMessageService.php \Drupal\private_message\Service\PrivateMessageService::getThreadForMembers()
Retrieves the private message thread for the given members.
If no thread exists, one will be created.
Parameters
\Drupal\user\UserInterface[] $members: An array of User objects for whom the private message thread should be retrieved.
Return value
\Drupal\private_message\Entity\PrivateMessageThread A private message thread that contains all members in the thread.
Overrides PrivateMessageServiceInterface::getThreadForMembers
File
- src/
Service/ PrivateMessageService.php, line 120
Class
- PrivateMessageService
- The Private Message service for the private message module.
Namespace
Drupal\private_message\ServiceCode
public function getThreadForMembers(array $members) {
$thread_id = $this->mapper
->getThreadIdForMembers($members);
if ($thread_id) {
return $this->pmThreadManager
->load($thread_id);
}
else {
return $this
->createPrivateMessageThread($members);
}
}