-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
87 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,18 @@ | |
* Copyright © MagePal LLC. All rights reserved. | ||
* See COPYING.txt for license details. | ||
* http://www.magepal.com | [email protected] | ||
*/ | ||
*/ | ||
|
||
namespace MagePal\NewsletterSignupEmail\Helper; | ||
|
||
class Data extends \Magento\Framework\App\Helper\AbstractHelper | ||
use Magento\Framework\App\Helper\AbstractHelper; | ||
use Magento\Store\Model\ScopeInterface; | ||
|
||
/** | ||
* Class Data | ||
* @package MagePal\NewsletterSignupEmail\Helper | ||
*/ | ||
class Data extends AbstractHelper | ||
{ | ||
const XML_PATH_ACTIVE = 'newsletter_signup_email/general/active'; | ||
|
||
|
@@ -20,7 +27,7 @@ public function isEnabled() | |
{ | ||
return !$this->scopeConfig->isSetFlag( | ||
self::XML_PATH_ACTIVE, | ||
\Magento\Store\Model\ScopeInterface::SCOPE_STORE | ||
ScopeInterface::SCOPE_STORE | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,49 +4,53 @@ | |
* See COPYING.txt for license details. | ||
* http://www.magepal.com | [email protected] | ||
*/ | ||
|
||
namespace MagePal\NewsletterSignupEmail\Plugin\Model; | ||
|
||
use Magento\Newsletter\Model\Subscriber; | ||
use MagePal\NewsletterSignupEmail\Helper\Data; | ||
|
||
class SubscriberPlugin | ||
{ | ||
|
||
/** @var \MagePal\NewsletterSignupEmail\Helper\Data */ | ||
/** @var Data */ | ||
protected $helper; | ||
|
||
public function __construct( | ||
\MagePal\NewsletterSignupEmail\Helper\Data $helper | ||
Data $helper | ||
) { | ||
$this->helper = $helper; | ||
} | ||
|
||
/** | ||
* @param \Magento\Newsletter\Model\Subscriber $subject | ||
* @param Subscriber $subject | ||
* @param callable $proceed | ||
*/ | ||
public function aroundSendUnsubscriptionEmail(\Magento\Newsletter\Model\Subscriber $subject, callable $proceed) | ||
public function aroundSendUnsubscriptionEmail(Subscriber $subject, callable $proceed) | ||
{ | ||
if($this->helper->isEnabled()){ | ||
if ($this->helper->isEnabled()) { | ||
$proceed(); | ||
} | ||
} | ||
|
||
/** | ||
* @param \Magento\Newsletter\Model\Subscriber $subject | ||
* @param Subscriber $subject | ||
* @param callable $proceed | ||
*/ | ||
public function aroundSendConfirmationRequestEmail(\Magento\Newsletter\Model\Subscriber $subject, callable $proceed) | ||
public function aroundSendConfirmationRequestEmail(Subscriber $subject, callable $proceed) | ||
{ | ||
if($this->helper->isEnabled()){ | ||
if ($this->helper->isEnabled()) { | ||
$proceed(); | ||
} | ||
} | ||
|
||
/** | ||
* @param \Magento\Newsletter\Model\Subscriber $subject | ||
* @param Subscriber $subject | ||
* @param callable $proceed | ||
*/ | ||
public function aroundSendConfirmationSuccessEmail(\Magento\Newsletter\Model\Subscriber $subject, callable $proceed) | ||
public function aroundSendConfirmationSuccessEmail(Subscriber $subject, callable $proceed) | ||
{ | ||
if($this->helper->isEnabled()){ | ||
if ($this->helper->isEnabled()) { | ||
$proceed(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters