protected function MailhandlerNode::createNode in Mailhandler 8
Creates a new node from given mail message.
Parameters
\Drupal\inmail\MIME\MimeMessageInterface $message: The mail message.
\Drupal\inmail\DefaultAnalyzerResult $result: The analyzer result.
Return value
\Drupal\node\Entity\Node The created node.
Throws
\Exception Throws an exception in case user is not authorized to create a node.
1 call to MailhandlerNode::createNode()
- MailhandlerNode::invoke in src/
Plugin/ inmail/ Handler/ MailhandlerNode.php
File
- src/
Plugin/ inmail/ Handler/ MailhandlerNode.php, line 115
Class
- MailhandlerNode
- Message handler that creates a node from a mail message.
Namespace
Drupal\mailhandler\Plugin\inmail\HandlerCode
protected function createNode(MimeMessageInterface $message, DefaultAnalyzerResult $result) {
$node = Node::create([
'type' => $this
->getContentType($result),
'body' => [
'value' => $result
->getBody(),
'format' => 'full_html',
],
'uid' => \Drupal::currentUser()
->getAccount(),
'title' => $result
->getSubject(),
]);
$node
->save();
return $node;
}