-
Notifications
You must be signed in to change notification settings - Fork 110
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
1 parent
c20d3f7
commit 90894b1
Showing
13 changed files
with
641 additions
and
96 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<?php | ||
/** | ||
* mc-magento2 Magento Component | ||
* | ||
* @category Ebizmarts | ||
* @package mc-magento2 | ||
* @author Ebizmarts Team <info@ebizmarts.com> | ||
* @copyright Ebizmarts (http://ebizmarts.com) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* @date: 2/20/17 3:25 PM | ||
* @file: ResetErrors.php | ||
*/ | ||
|
||
namespace Ebizmarts\MailChimp\Block\Adminhtml\System\Config; | ||
|
||
class ResetErrors extends \Magento\Config\Block\System\Config\Form\Field | ||
{ | ||
/** | ||
* @var \Ebizmarts\MailChimp\Helper\Data | ||
*/ | ||
private $_helper; | ||
|
||
/** | ||
* ResetErrors constructor. | ||
* @param \Magento\Backend\Block\Template\Context $context | ||
* @param \Ebizmarts\MailChimp\Helper\Data $helper | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
\Magento\Backend\Block\Template\Context $context, | ||
\Ebizmarts\MailChimp\Helper\Data $helper, | ||
array $data=[]) | ||
{ | ||
$this->_helper = $helper; | ||
parent::__construct($context, $data); | ||
} | ||
|
||
protected function _construct() | ||
{ | ||
parent::_construct(); | ||
$this->setTemplate('system/config/reseterrors.phtml'); | ||
} | ||
|
||
// protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element) | ||
// { | ||
// return $this->_toHtml(); | ||
// } | ||
protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element) | ||
{ | ||
$originalData = $element->getOriginalData(); | ||
$this->addData( | ||
[ | ||
'button_label' => __($originalData['button_label']), | ||
'button_url' => $this->getAjaxCheckUrl(), | ||
'html_id' => $element->getHtmlId(), | ||
] | ||
); | ||
return $this->_toHtml(); | ||
} | ||
|
||
public function getButtonHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element) | ||
{ | ||
|
||
|
||
$originalData = $element->getOriginalData(); | ||
$label = $originalData['button_label']; | ||
$this->addData([ | ||
'button_label' => __($label), | ||
'button_url' => $this->getAjaxCheckUrl(), | ||
'html_id' => $element->getHtmlId(), | ||
]); | ||
return $this->_toHtml(); | ||
|
||
|
||
// $button = $this->getLayout()->createBlock('adminhtml/widget_button') | ||
// ->setData( | ||
// array( | ||
// 'id' => 'reseterrors_button', | ||
// 'label' => $this->_helper->__('Reset Local Errors'), | ||
// 'onclick' => 'javascript:reseterrors(); return false;' | ||
// ) | ||
// ); | ||
// | ||
// return $button->toHtml(); | ||
} | ||
public function getAjaxCheckUrl() | ||
{ | ||
return $this->_urlBuilder->getUrl('mailchimp/ecommerce/ResetLocalErrors'); | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
/** | ||
* mc-magento2 Magento Component | ||
* | ||
* @category Ebizmarts | ||
* @package mc-magento2 | ||
* @author Ebizmarts Team <info@ebizmarts.com> | ||
* @copyright Ebizmarts (http://ebizmarts.com) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* @date: 2/21/17 5:07 PM | ||
* @file: ResetLocalErrors.php | ||
*/ | ||
|
||
namespace Ebizmarts\MailChimp\Controller\Adminhtml\Ecommerce; | ||
|
||
use Magento\Framework\Controller\Result\JsonFactory; | ||
|
||
class ResetLocalErrors extends \Magento\Backend\App\Action | ||
{ | ||
protected $resultJsonFactory; | ||
protected $helper; | ||
|
||
public function __construct( | ||
\Magento\Backend\App\Action\Context $context, | ||
JsonFactory $resultJsonFactory, | ||
\Ebizmarts\MailChimp\Helper\Data $helper | ||
) | ||
{ | ||
parent::__construct($context); | ||
$this->resultJsonFactory = $resultJsonFactory; | ||
$this->helper = $helper; | ||
} | ||
|
||
public function execute() | ||
{ | ||
$resultJson = $this->resultJsonFactory->create(); | ||
return $resultJson->setData([ | ||
'valid' => (int)1, | ||
'message' => 'OK', | ||
]); | ||
} | ||
protected function _isAllowed() | ||
{ | ||
return $this->_authorization->isAllowed('Magento_EncryptionKey::crypt_key'); | ||
} | ||
} |
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
Oops, something went wrong.