Merge pull request #15745 from seamuslee001/master
[civicrm-core.git] / CRM / Mailing / Form / Subscribe.php
index 6a8feae66b2e2668470f562bea6a334f63d9d881..ba617aac09532a9edc4b583a40a45576d943b4a5 100644 (file)
@@ -115,7 +115,7 @@ ORDER BY title";
         $rows[] = $row;
       }
       if (empty($rows)) {
-        CRM_Core_Error::fatal(ts('There are no public mailing list groups to display.'));
+        throw new CRM_Core_Exception(ts('There are no public mailing list groups to display.'));
       }
       $this->assign('rows', $rows);
       $this->addFormRule(['CRM_Mailing_Form_Subscribe', 'formRule']);
@@ -147,10 +147,7 @@ ORDER BY title";
     }
 
     if ($addCaptcha) {
-      // add captcha
-      $captcha = CRM_Utils_ReCAPTCHA::singleton();
-      $captcha->add($this);
-      $this->assign('isCaptcha', TRUE);
+      CRM_Utils_ReCAPTCHA::enableCaptchaOnForm($this);
     }
 
     $this->addButtons([