This repository has been archived by the owner on Feb 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46 from mageplaza/2.4-develop
Clean code
- Loading branch information
Showing
39 changed files
with
5,001 additions
and
5,001 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 |
---|---|---|
@@ -1,105 +1,105 @@ | ||
<?php | ||
/** | ||
* Mageplaza | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Mageplaza.com license that is | ||
* available through the world-wide-web at this URL: | ||
* https://www.mageplaza.com/LICENSE.txt | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this extension to newer | ||
* version in the future. | ||
* | ||
* @category Mageplaza | ||
* @package Mageplaza_Webhook | ||
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | ||
* @license https://www.mageplaza.com/LICENSE.txt | ||
*/ | ||
|
||
namespace Mageplaza\Webhook\Block\Adminhtml\Hook; | ||
|
||
use Magento\Backend\Block\Widget\Context; | ||
use Magento\Backend\Block\Widget\Form\Container; | ||
use Magento\Framework\Registry; | ||
use Mageplaza\Webhook\Model\Hook; | ||
|
||
/** | ||
* Class Edit | ||
* @package Mageplaza\Webhook\Block\Adminhtml\Hook | ||
*/ | ||
class Edit extends Container | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $_objectId = 'hook_id'; | ||
|
||
/** | ||
* Core registry | ||
* | ||
* @var Registry | ||
*/ | ||
protected $coreRegistry; | ||
|
||
/** | ||
* constructor | ||
* | ||
* @param Registry $coreRegistry | ||
* @param Context $context | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
Registry $coreRegistry, | ||
Context $context, | ||
array $data = [] | ||
) { | ||
$this->coreRegistry = $coreRegistry; | ||
|
||
parent::__construct($context, $data); | ||
} | ||
|
||
/** | ||
* Initialize Hook edit block | ||
* | ||
* @return void | ||
*/ | ||
protected function _construct() | ||
{ | ||
$this->_blockGroup = 'Mageplaza_Webhook'; | ||
$this->_controller = 'adminhtml_hook'; | ||
|
||
parent::_construct(); | ||
|
||
$this->buttonList->add('save-and-continue', [ | ||
'label' => __('Save and Continue Edit'), | ||
'class' => 'save', | ||
'data_attribute' => [ | ||
'mage-init' => [ | ||
'button' => [ | ||
'event' => 'saveAndContinueEdit', | ||
'target' => '#edit_form' | ||
] | ||
] | ||
] | ||
], -100); | ||
} | ||
|
||
/** | ||
* Get form action URL | ||
* | ||
* @return string | ||
*/ | ||
public function getFormActionUrl() | ||
{ | ||
/** @var Hook $hook */ | ||
$hook = $this->coreRegistry->registry('mageplaza_webhook_hook'); | ||
if ($id = $hook->getId()) { | ||
return $this->getUrl('*/*/save', ['hook_id' => $id]); | ||
} | ||
|
||
return parent::getFormActionUrl(); | ||
} | ||
} | ||
<?php | ||
/** | ||
* Mageplaza | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Mageplaza.com license that is | ||
* available through the world-wide-web at this URL: | ||
* https://www.mageplaza.com/LICENSE.txt | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this extension to newer | ||
* version in the future. | ||
* | ||
* @category Mageplaza | ||
* @package Mageplaza_Webhook | ||
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | ||
* @license https://www.mageplaza.com/LICENSE.txt | ||
*/ | ||
|
||
namespace Mageplaza\Webhook\Block\Adminhtml\Hook; | ||
|
||
use Magento\Backend\Block\Widget\Context; | ||
use Magento\Backend\Block\Widget\Form\Container; | ||
use Magento\Framework\Registry; | ||
use Mageplaza\Webhook\Model\Hook; | ||
|
||
/** | ||
* Class Edit | ||
* @package Mageplaza\Webhook\Block\Adminhtml\Hook | ||
*/ | ||
class Edit extends Container | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $_objectId = 'hook_id'; | ||
|
||
/** | ||
* Core registry | ||
* | ||
* @var Registry | ||
*/ | ||
protected $coreRegistry; | ||
|
||
/** | ||
* constructor | ||
* | ||
* @param Registry $coreRegistry | ||
* @param Context $context | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
Registry $coreRegistry, | ||
Context $context, | ||
array $data = [] | ||
) { | ||
$this->coreRegistry = $coreRegistry; | ||
|
||
parent::__construct($context, $data); | ||
} | ||
|
||
/** | ||
* Initialize Hook edit block | ||
* | ||
* @return void | ||
*/ | ||
protected function _construct() | ||
{ | ||
$this->_blockGroup = 'Mageplaza_Webhook'; | ||
$this->_controller = 'adminhtml_hook'; | ||
|
||
parent::_construct(); | ||
|
||
$this->buttonList->add('save-and-continue', [ | ||
'label' => __('Save and Continue Edit'), | ||
'class' => 'save', | ||
'data_attribute' => [ | ||
'mage-init' => [ | ||
'button' => [ | ||
'event' => 'saveAndContinueEdit', | ||
'target' => '#edit_form' | ||
] | ||
] | ||
] | ||
], -100); | ||
} | ||
|
||
/** | ||
* Get form action URL | ||
* | ||
* @return string | ||
*/ | ||
public function getFormActionUrl() | ||
{ | ||
/** @var Hook $hook */ | ||
$hook = $this->coreRegistry->registry('mageplaza_webhook_hook'); | ||
if ($id = $hook->getId()) { | ||
return $this->getUrl('*/*/save', ['hook_id' => $id]); | ||
} | ||
|
||
return parent::getFormActionUrl(); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,53 +1,53 @@ | ||
<?php | ||
/** | ||
* Mageplaza | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Mageplaza.com license that is | ||
* available through the world-wide-web at this URL: | ||
* https://www.mageplaza.com/LICENSE.txt | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this extension to newer | ||
* version in the future. | ||
* | ||
* @category Mageplaza | ||
* @package Mageplaza_Webhook | ||
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | ||
* @license https://www.mageplaza.com/LICENSE.txt | ||
*/ | ||
|
||
namespace Mageplaza\Webhook\Block\Adminhtml\Hook\Edit; | ||
|
||
use Magento\Backend\Block\Widget\Form\Generic; | ||
|
||
/** | ||
* Class Form | ||
* @package Mageplaza\Webhook\Block\Adminhtml\Hook\Edit | ||
*/ | ||
class Form extends Generic | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function _prepareForm() | ||
{ | ||
/** @var \Magento\Framework\Data\Form $form */ | ||
$form = $this->_formFactory->create( | ||
[ | ||
'data' => [ | ||
'id' => 'edit_form', | ||
'action' => $this->getData('action'), | ||
'method' => 'post', | ||
'enctype' => 'multipart/form-data' | ||
] | ||
] | ||
); | ||
$form->setUseContainer(true); | ||
$this->setForm($form); | ||
|
||
return parent::_prepareForm(); | ||
} | ||
} | ||
<?php | ||
/** | ||
* Mageplaza | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Mageplaza.com license that is | ||
* available through the world-wide-web at this URL: | ||
* https://www.mageplaza.com/LICENSE.txt | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this extension to newer | ||
* version in the future. | ||
* | ||
* @category Mageplaza | ||
* @package Mageplaza_Webhook | ||
* @copyright Copyright (c) Mageplaza (https://www.mageplaza.com/) | ||
* @license https://www.mageplaza.com/LICENSE.txt | ||
*/ | ||
|
||
namespace Mageplaza\Webhook\Block\Adminhtml\Hook\Edit; | ||
|
||
use Magento\Backend\Block\Widget\Form\Generic; | ||
|
||
/** | ||
* Class Form | ||
* @package Mageplaza\Webhook\Block\Adminhtml\Hook\Edit | ||
*/ | ||
class Form extends Generic | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
protected function _prepareForm() | ||
{ | ||
/** @var \Magento\Framework\Data\Form $form */ | ||
$form = $this->_formFactory->create( | ||
[ | ||
'data' => [ | ||
'id' => 'edit_form', | ||
'action' => $this->getData('action'), | ||
'method' => 'post', | ||
'enctype' => 'multipart/form-data' | ||
] | ||
] | ||
); | ||
$form->setUseContainer(true); | ||
$this->setForm($form); | ||
|
||
return parent::_prepareForm(); | ||
} | ||
} |
Oops, something went wrong.