function simplenews_node_presave in Simplenews 8
Same name and namespace in other branches
- 8.2 simplenews.module \simplenews_node_presave()
- 7 simplenews.module \simplenews_node_presave()
- 3.x simplenews.module \simplenews_node_presave()
Implements hook_node_presave().
File
- ./
simplenews.module, line 119 - Simplenews node handling, sent email, newsletter block and general hooks
Code
function simplenews_node_presave(NodeInterface $node) {
if (!$node
->hasField('simplenews_issue')) {
return;
}
// Check if the newsletter is set to send on publish and needs to be send.
if ($node->simplenews_issue->status == SIMPLENEWS_STATUS_SEND_PUBLISH && $node
->isPublished()) {
\Drupal::service('simplenews.spool_storage')
->addFromEntity($node);
}
}