diff --git a/src/Form/NodeTabForm.php b/src/Form/NodeTabForm.php index 9cc367e..1f48ebe 100644 --- a/src/Form/NodeTabForm.php +++ b/src/Form/NodeTabForm.php @@ -34,7 +34,7 @@ class NodeTabForm extends FormBase { $subscriber_count = simplenews_count_subscriptions($node->id()); $status = $node->simplenews_issue->status; - $form['#title'] = t('Newsletter @title', array('@title' => $node->getTitle())); + $form['#title'] = t('Newsletter issue @title', array('@title' => $node->getTitle())); // We will need the node. $form_state->set('node', $node); @@ -114,37 +114,30 @@ class NodeTabForm extends FormBase { '#markup' => t('Send newsletter issue to @count subscribers.', array('@count' => $subscriber_count)), ); if (!$config->get('mail.use_cron')) { - $send_text = t('Mails will be sent immediately.', array('@count' => $subscriber_count)); + $send_text = t('Mails will be sent immediately.'); } else { - $send_text = t('Mails will be sent when cron runs.', array('@count' => $subscriber_count)); + $send_text = t('Mails will be sent when cron runs.'); } $form['send']['method'] = array( '#type' => 'item', '#markup' => $send_text, ); - $form['send']['send_button'] = array( - '#type' => 'submit', - '#button_type' => 'primary', - '#name' => 'send_now', - ); if ($node->isPublished()) { - $form['send']['send_button'] = array( + $form['send']['send_now'] = array( '#type' => 'submit', '#button_type' => 'primary', '#value' => t('Send now'), - '#name' => 'send_now', - '#submit' => array('::submitSendNow'), + '#submit' => array('::submitForm', '::submitSendNow'), ); } else { - $form['send']['send_button'] = array( + $form['send']['send_on_publish'] = array( '#type' => 'submit', '#button_type' => 'primary', '#value' => t('Send on publish'), - '#name' => 'send_now', - '#submit' => array('::submitSendLater'), + '#submit' => array('::submitForm', '::submitSendLater'), ); } } @@ -183,7 +176,6 @@ class NodeTabForm extends FormBase { $config = \Drupal::config('simplenews.settings'); $values = $form_state->getValues(); - $node = $form_state->get('node'); // Validate recipient handler settings. if (!empty($form['recipient_handler_settings'])) {