You are here

public function NodeTabForm::submitSendLater in Simplenews 8

Submit handler for sending unpublished newsletter issue.

Parameters

array $form: An associative array containing the structure of the form.

File

src/Form/NodeTabForm.php, line 321

Class

NodeTabForm
Configure simplenews subscriptions of a user.

Namespace

Drupal\simplenews\Form

Code

public function submitSendLater(array &$form, FormStateInterface $form_state) {
  $node = $form_state
    ->get('node');

  // Set the node to pending status.
  $node->simplenews_issue->status = SIMPLENEWS_STATUS_SEND_PUBLISH;
  $this
    ->messenger()
    ->addMessage(t('Newsletter issue %title will be sent when published.', array(
    '%title' => $node
      ->getTitle(),
  )));
  $node
    ->save();
}