Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lint #107

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

lint #107

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions Block/Adminhtml/Rule.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?php
namespace Astound\Affirm\Block\Adminhtml;
class Rule extends \Magento\Backend\Block\Widget\Grid\Container
{
protected function _construct()
{
$this->_controller = 'adminhtml_rule';
$this->_headerText = __('Payment Restriction Rules');
$this->_addButtonLabel = __('Add Rule');
parent::_construct();
}
}
<?php
namespace Astound\Affirm\Block\Adminhtml;

class Rule extends \Magento\Backend\Block\Widget\Grid\Container
{
protected function _construct()
{
$this->_controller = 'adminhtml_rule';
$this->_headerText = __('Payment Restriction Rules');
$this->_addButtonLabel = __('Add Rule');
parent::_construct();
}
}
95 changes: 47 additions & 48 deletions Block/Adminhtml/Rule/Edit.php
Original file line number Diff line number Diff line change
@@ -1,48 +1,47 @@
<?php
namespace Astound\Affirm\Block\Adminhtml\Rule;

class Edit extends \Magento\Backend\Block\Widget\Form\Container
{
protected $_coreRegistry = null;

public function __construct(
\Magento\Backend\Block\Widget\Context $context,
\Magento\Framework\Registry $registry,
array $data = []
) {
$this->_coreRegistry = $registry;
parent::__construct($context, $data);
}

protected function _construct()
{
$this->_objectId = 'id';
$this->_controller = 'adminhtml_rule';
$this->_blockGroup = 'Astound_Affirm';

parent::_construct();

$this->buttonList->add(
'save_and_continue_edit',
[
'class' => 'save',
'label' => __('Save and Continue Edit'),
'data_attribute' => [
'mage-init' => ['button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form']],
]
],
10
);
}

public function getHeaderText()
{
$model = $this->_coreRegistry->registry('affirm_payment_restriction_rule');
if($model->getId()) {
$title = __('Edit Payment Restriction Rule `%1`', $model->getName());
} else {
$title = __("Add new Payment Restriction Rule");
}
}

}
<?php
namespace Astound\Affirm\Block\Adminhtml\Rule;

class Edit extends \Magento\Backend\Block\Widget\Form\Container
{
protected $_coreRegistry = null;

public function __construct(
\Magento\Backend\Block\Widget\Context $context,
\Magento\Framework\Registry $registry,
array $data = []
) {
$this->_coreRegistry = $registry;
parent::__construct($context, $data);
}

protected function _construct()
{
$this->_objectId = 'id';
$this->_controller = 'adminhtml_rule';
$this->_blockGroup = 'Astound_Affirm';

parent::_construct();

$this->buttonList->add(
'save_and_continue_edit',
[
'class' => 'save',
'label' => __('Save and Continue Edit'),
'data_attribute' => [
'mage-init' => ['button' => ['event' => 'saveAndContinueEdit', 'target' => '#edit_form']],
]
],
10
);
}

public function getHeaderText()
{
$model = $this->_coreRegistry->registry('affirm_payment_restriction_rule');
if ($model->getId()) {
$title = __('Edit Payment Restriction Rule `%1`', $model->getName());
} else {
$title = __("Add new Payment Restriction Rule");
}
}
}
58 changes: 29 additions & 29 deletions Block/Adminhtml/Rule/Edit/Form.php
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
<?php
namespace Astound\Affirm\Block\Adminhtml\Rule\Edit;
class Form extends \Magento\Backend\Block\Widget\Form\Generic
{
protected function _construct()
{
parent::_construct();
$this->setId('affirm_rule_edit_form');
$this->setTitle(__('Payment Restriction Information'));
}
protected function _prepareForm()
{
$form = $this->_formFactory->create(
[
'data' => [
'id' => 'edit_form',
'action' => $this->getUrl('*/*/save'),
'method' => 'post',
'enctype' => 'multipart/form-data',
],
]
);
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
}
<?php
namespace Astound\Affirm\Block\Adminhtml\Rule\Edit;

class Form extends \Magento\Backend\Block\Widget\Form\Generic
{
protected function _construct()
{
parent::_construct();
$this->setId('affirm_rule_edit_form');
$this->setTitle(__('Payment Restriction Information'));
}

protected function _prepareForm()
{
$form = $this->_formFactory->create(
[
'data' => [
'id' => 'edit_form',
'action' => $this->getUrl('*/*/save'),
'method' => 'post',
'enctype' => 'multipart/form-data',
],
]
);
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
}
167 changes: 84 additions & 83 deletions Block/Adminhtml/Rule/Edit/Tab/Conditions.php
Original file line number Diff line number Diff line change
@@ -1,84 +1,85 @@
<?php
namespace Astound\Affirm\Block\Adminhtml\Rule\Edit\Tab;
use Magento\Backend\Block\Widget\Form\Generic;
use Magento\Backend\Block\Widget\Tab\TabInterface;
<?php
namespace Astound\Affirm\Block\Adminhtml\Rule\Edit\Tab;

class Conditions extends Generic implements TabInterface
{
protected $_rendererFieldset;
protected $_conditions;

public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Framework\Data\FormFactory $formFactory,
\Magento\Rule\Block\Conditions $conditions,
\Magento\Backend\Block\Widget\Form\Renderer\Fieldset $rendererFieldset,
array $data
) {
$this->_rendererFieldset = $rendererFieldset;
$this->_conditions = $conditions;
parent::__construct($context, $registry, $formFactory, $data);
}

public function getTabLabel()
{
return __('Conditions');
}

public function getTabTitle()
{
return __('Conditions');
}

public function canShowTab()
{
return true;
}

public function isHidden()
{
return false;
}

protected function _prepareForm()
{
$model = $this->_coreRegistry->registry('affirm_payment_restriction_rule');
$om = \Magento\Framework\App\ObjectManager::getInstance();
$hlp = $om->get('Astound\Affirm\Helper\Data');

$form = $this->_formFactory->create();

$renderer = $this->_rendererFieldset->setTemplate(
'Magento_CatalogRule::promo/fieldset.phtml'
)->setNewChildUrl(
$this->getUrl('*/*/newConditionHtml/form/rule_conditions_fieldset')
);

$fieldset = $form->addFieldset(
'rule_conditions_fieldset',
[
'legend' => __(
'Apply the rule only if the following conditions are met (leave blank for all products).'
)
]
)->setRenderer(
$renderer
);

$fieldset->addField(
'conditions',
'text',
['name' => 'conditions', 'label' => __('Conditions'), 'title' => __('Conditions')]
)->setRule(
$model
)->setRenderer(
$this->_conditions
);

$form->setValues($model->getData());
$form->addValues(['id'=>$model->getId()]);
$this->setForm($form);
return parent::_prepareForm();
}
}
use Magento\Backend\Block\Widget\Form\Generic;
use Magento\Backend\Block\Widget\Tab\TabInterface;

class Conditions extends Generic implements TabInterface
{
protected $_rendererFieldset;
protected $_conditions;

public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Framework\Registry $registry,
\Magento\Framework\Data\FormFactory $formFactory,
\Magento\Rule\Block\Conditions $conditions,
\Magento\Backend\Block\Widget\Form\Renderer\Fieldset $rendererFieldset,
array $data
) {
$this->_rendererFieldset = $rendererFieldset;
$this->_conditions = $conditions;
parent::__construct($context, $registry, $formFactory, $data);
}

public function getTabLabel()
{
return __('Conditions');
}

public function getTabTitle()
{
return __('Conditions');
}

public function canShowTab()
{
return true;
}

public function isHidden()
{
return false;
}

protected function _prepareForm()
{
$model = $this->_coreRegistry->registry('affirm_payment_restriction_rule');
$om = \Magento\Framework\App\ObjectManager::getInstance();
$hlp = $om->get('Astound\Affirm\Helper\Data');

$form = $this->_formFactory->create();

$renderer = $this->_rendererFieldset->setTemplate(
'Magento_CatalogRule::promo/fieldset.phtml'
)->setNewChildUrl(
$this->getUrl('*/*/newConditionHtml/form/rule_conditions_fieldset')
);

$fieldset = $form->addFieldset(
'rule_conditions_fieldset',
[
'legend' => __(
'Apply the rule only if the following conditions are met (leave blank for all products).'
)
]
)->setRenderer(
$renderer
);

$fieldset->addField(
'conditions',
'text',
['name' => 'conditions', 'label' => __('Conditions'), 'title' => __('Conditions')]
)->setRule(
$model
)->setRenderer(
$this->_conditions
);

$form->setValues($model->getData());
$form->addValues(['id'=>$model->getId()]);
$this->setForm($form);
return parent::_prepareForm();
}
}
Loading