Skip to content

Commit

Permalink
comment,clear code
Browse files Browse the repository at this point in the history
  • Loading branch information
btn114 committed Nov 27, 2018
1 parent dc2b16b commit b5597c6
Show file tree
Hide file tree
Showing 87 changed files with 690 additions and 1,176 deletions.
3 changes: 2 additions & 1 deletion Block/Adminhtml/Hook/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ public function __construct(
array $data = []
)
{
$this->coreRegistry = $coreRegistry;
parent::__construct($context, $data);

$this->coreRegistry = $coreRegistry;
}

/**
Expand Down
16 changes: 15 additions & 1 deletion Block/Adminhtml/Hook/Edit/Tab/Actions.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,23 @@ class Actions extends Generic implements TabInterface
* @var FieldFactory
*/
protected $fieldFactory;
protected $authentication;

/**
* @var Authentication
*/
protected $authentication;

/**
* Actions constructor.
* @param Context $context
* @param Registry $registry
* @param FormFactory $formFactory
* @param FieldFactory $fieldFactory
* @param Method $method
* @param ContentType $contentType
* @param Authentication $authentication
* @param array $data
*/
public function __construct(
Context $context,
Registry $registry,
Expand Down
11 changes: 0 additions & 11 deletions Block/Adminhtml/Hook/Edit/Tab/General.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,11 @@
use Magento\Backend\Block\Widget\Form\Generic;
use Magento\Backend\Block\Widget\Tab\TabInterface;
use Magento\Config\Model\Config\Source\Enabledisable;
use Magento\Cron\Model\Config\Source\Frequency;
use Magento\Framework\Data\FormFactory;
use Magento\Framework\Registry;
use Magento\Store\Model\System\Store;
use Mageplaza\Webhook\Helper\Data;
use Mageplaza\Webhook\Model\Config\Source\HookType;


/**
* Class General
* @package Mageplaza\Webhook\Block\Adminhtml\Hook\Edit\Tab
Expand All @@ -49,19 +46,13 @@ class General extends Generic implements TabInterface
*/
protected $systemStore;

/**
* @var Data
*/
protected $helperData;

/**
* General constructor.
* @param Context $context
* @param Registry $registry
* @param FormFactory $formFactory
* @param Enabledisable $enableDisable
* @param Store $systemStore
* @param Data $helperData
* @param array $data
*/
public function __construct(
Expand All @@ -70,15 +61,13 @@ public function __construct(
FormFactory $formFactory,
Enabledisable $enableDisable,
Store $systemStore,
Data $helperData,
array $data = []
)
{
parent::__construct($context, $registry, $formFactory, $data);

$this->enabledisable = $enableDisable;
$this->systemStore = $systemStore;
$this->helperData = $helperData;
}

/**
Expand Down
64 changes: 34 additions & 30 deletions Block/Adminhtml/Hook/Edit/Tab/Renderer/Body.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,18 @@
use Magento\Backend\Block\Widget\Form\Renderer\Fieldset\Element;
use Magento\Framework\Data\Form\Element\Renderer\RendererInterface;
use Magento\Framework\DataObject;
use Magento\Framework\Json\Helper\Data as JsonHelper;
use Magento\Framework\Registry;
use Magento\Sales\Model\OrderFactory;
use Magento\Quote\Model\ResourceModel\Quote;
use Magento\Sales\Model\ResourceModel\Order\Address as AddressResource;
use Magento\Sales\Model\ResourceModel\Order\Creditmemo as CreditmemoResource;
use Magento\Sales\Model\ResourceModel\Order\Invoice as InvoiceResource;
use Magento\Sales\Model\ResourceModel\Order\Shipment as ShipmentResource;
use Magento\Sales\Model\ResourceModel\Order\Status as OrderStatusResource;
use Magento\Customer\Model\ResourceModel\Customer as CustomerResource;
use Mageplaza\Webhook\Block\Adminhtml\LiquidFilters;
use Mageplaza\Webhook\Helper\Data;
use Mageplaza\Webhook\Model\Config\Source\HookType;
use Mageplaza\Webhook\Model\Hook;
use Mageplaza\Webhook\Model\HookFactory;
use Magento\Catalog\Model\ResourceModel\Eav\Attribute as CatalogEavAttr;
use Magento\Eav\Model\Entity\Attribute\Set as AttributeSet;
use Magento\Customer\Model\ResourceModel\Customer\CollectionFactory as CustomerCollectionFactory;
use Magento\Catalog\Model\CategoryFactory;

/**
Expand All @@ -68,13 +62,7 @@ class Body extends Element implements RendererInterface
protected $liquidFilters;

/**
* @var Registry
*/
protected $registry;


/**
* @var JsonHelper
* @var InvoiceResource
*/
protected $invoiceResource;

Expand All @@ -89,37 +77,53 @@ class Body extends Element implements RendererInterface
protected $creditmemoResource;

/**
* @var AddressResource
* @var HookFactory
*/
protected $addressResource;
protected $hookFactory;

/**
* @var HookFactory
* @var OrderStatusResource
*/
protected $hookFactory;
protected $orderStatusResource;

/**
* @var CustomerResource
*/
protected $customerResource;

/**
* @var CatalogEavAttr
*/
protected $catalogEavAttribute;

/**
* @var CategoryFactory
*/
protected $categoryFactory;

/**
* @var Quote
*/
protected $quoteResource;

/**
* TemplateContent constructor.
*
* Body constructor.
* @param Context $context
* @param AddressResource $addressResource
* @param OrderFactory $orderFactory
* @param InvoiceResource $invoiceResource
* @param ShipmentResource $shipmentResource
* @param CreditmemoResource $creditmemoResource
* @param Registry $registry
* @param OrderStatusResource $orderStatusResource
* @param CustomerResource $customerResource
* @param Quote $quoteResource
* @param CatalogEavAttr $catalogEavAttribute
* @param CategoryFactory $categoryFactory
* @param LiquidFilters $liquidFilters
* @param HookFactory $hookFactory
* @param array $data
*/
public function __construct(
Context $context,
AddressResource $addressResource,
OrderFactory $orderFactory,
InvoiceResource $invoiceResource,
ShipmentResource $shipmentResource,
Expand All @@ -129,20 +133,17 @@ public function __construct(
Quote $quoteResource,
CatalogEavAttr $catalogEavAttribute,
CategoryFactory $categoryFactory,
Registry $registry,
LiquidFilters $liquidFilters,
HookFactory $hookFactory,
array $data = [])
{
parent::__construct($context, $data);

$this->registry = $registry;
$this->liquidFilters = $liquidFilters;
$this->orderFactory = $orderFactory;
$this->invoiceResource = $invoiceResource;
$this->shipmentResource = $shipmentResource;
$this->creditmemoResource = $creditmemoResource;
$this->addressResource = $addressResource;
$this->hookFactory = $hookFactory;
$this->orderStatusResource = $orderStatusResource;
$this->customerResource = $customerResource;
Expand Down Expand Up @@ -248,6 +249,10 @@ public function getHookAttrCollection()
return $attrCollection;
}

/**
* @param $collection
* @return array
*/
protected function getAttrCollectionFromDb($collection)
{
$attrCollection = [];
Expand All @@ -260,6 +265,10 @@ protected function getAttrCollectionFromDb($collection)
return $attrCollection;
}

/**
* @param $collection
* @return array
*/
protected function getAttrCollectionFromEav($collection)
{
$attrCollection = [];
Expand All @@ -279,9 +288,4 @@ public function getModifier()
{
return $this->liquidFilters->getFilters();
}

public function getElement()
{
return parent::getElement(); // TODO: Change the autogenerated stub
}
}
37 changes: 7 additions & 30 deletions Block/Adminhtml/Hook/Edit/Tab/Renderer/Headers.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,25 @@
* version in the future.
*
* @category Mageplaza
* @package Mageplaza_BetterCoupon
* @copyright Copyright (c) 2018 Mageplaza (https://www.mageplaza.com/)
* @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\Tab\Renderer;

use Magento\Backend\Block\Template\Context;
use Magento\Config\Block\System\Config\Form\Field\FieldArray\AbstractFieldArray;
use Magento\Framework\Data\Form\Element\AbstractElement;

/**
* Class LinkGenerator
* @package Mageplaza\BetterCoupon\Block\Adminhtml\System\Config
* Class Headers
* @package Mageplaza\Webhook\Block\Adminhtml\Hook\Edit\Tab\Renderer
*/
class Headers extends AbstractFieldArray
{
protected $_template = 'Mageplaza_Webhook::hook/headers.phtml';
protected $_element;

/**
* Header constructor.
* @param Context $context
* @param array $data
* @var string
*/
public function __construct(Context $context, array $data = [])
{
parent::__construct($context, $data);
}
protected $_template = 'Mageplaza_Webhook::hook/headers.phtml';

/**
* Initialise form fields
Expand All @@ -67,18 +58,4 @@ public function getAddButtonLabel()
{
return __('Add');
}

// public function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
// {
// return parent::_getElementHtml($element); // TODO: Change the autogenerated stub
// }
// public function getElement()
// {
// return $this->_element;
// }
// public function render(AbstractElement $element)
// {
// $this->_element = $element;
// return parent:: render($element);
// }
}
18 changes: 3 additions & 15 deletions Block/Adminhtml/Logs/Edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

/**
* Class Edit
* @package Mageplaza\Webhook\Block\Adminhtml\Hook
* @package Mageplaza\Webhook\Block\Adminhtml\Logs
*/
class Edit extends Container
{
Expand Down Expand Up @@ -56,8 +56,9 @@ public function __construct(
array $data = []
)
{
$this->coreRegistry = $coreRegistry;
parent::__construct($context, $data);

$this->coreRegistry = $coreRegistry;
}

/**
Expand All @@ -71,18 +72,5 @@ protected function _construct()
$this->_controller = 'adminhtml_logs';

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);
}
}
14 changes: 13 additions & 1 deletion Block/Adminhtml/Logs/Edit/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,23 @@

/**
* Class Form
* @package Mageplaza\Webhook\Block\Adminhtml\Hook\Edit
* @package Mageplaza\Webhook\Block\Adminhtml\Logs\Edit
*/
class Form extends Generic
{
/**
* @var HookType
*/
protected $hookType;

/**
* Form constructor.
* @param Context $context
* @param Registry $registry
* @param FormFactory $formFactory
* @param HookType $hookType
* @param array $data
*/
public function __construct(
Context $context,
Registry $registry,
Expand All @@ -43,6 +54,7 @@ public function __construct(
array $data = [])
{
parent::__construct($context, $registry, $formFactory, $data);

$this->hookType = $hookType;
}

Expand Down
Loading

0 comments on commit b5597c6

Please sign in to comment.