ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace Olegnax\BannerSlider\Block\Adminhtml\Group\Edit;
|
||||
|
||||
use Magento\Backend\Block\Template\Context;
|
||||
use Magento\Backend\Block\Widget\Form\Generic;
|
||||
use Magento\Framework\Data\FormFactory;
|
||||
use Magento\Framework\Registry;
|
||||
use Magento\Store\Model\System\Store;
|
||||
|
||||
class Form extends Generic {
|
||||
|
||||
protected $_systemStore;
|
||||
|
||||
public function __construct(
|
||||
Context $context,
|
||||
Registry $registry,
|
||||
FormFactory $formFactory,
|
||||
Store $systemStore,
|
||||
array $data = [ ]
|
||||
) {
|
||||
$this->_systemStore = $systemStore;
|
||||
parent::__construct( $context, $registry, $formFactory, $data );
|
||||
}
|
||||
|
||||
protected function _construct() {
|
||||
parent::_construct();
|
||||
$this->setId( 'group_form' );
|
||||
$this->setTitle( __( 'Group' ) );
|
||||
}
|
||||
|
||||
protected function _prepareForm() {
|
||||
$form = $this->_formFactory->create(
|
||||
[
|
||||
'data' => [
|
||||
'id' => 'edit_form',
|
||||
'action' => $this->getData( 'action' ),
|
||||
'enctype'=>'multipart/form-data',
|
||||
'method' => 'post',
|
||||
|
||||
]
|
||||
]
|
||||
);
|
||||
$form->setUseContainer( true );
|
||||
$this->setForm( $form );
|
||||
|
||||
return parent::_prepareForm();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
namespace Olegnax\BannerSlider\Block\Adminhtml\Group\Edit\Tab;
|
||||
|
||||
use Magento\Backend\Block\Template\Context;
|
||||
use Magento\Backend\Block\Widget\Form\Generic;
|
||||
use Magento\Backend\Block\Widget\Tab\TabInterface;
|
||||
use Magento\Framework\Data\FormFactory;
|
||||
use Magento\Framework\Registry;
|
||||
use Magento\Store\Model\System\Store;
|
||||
|
||||
class General extends Generic implements TabInterface {
|
||||
|
||||
/**
|
||||
* @var Store
|
||||
*/
|
||||
protected $_systemStore;
|
||||
|
||||
public function __construct(
|
||||
Store $systemStore,
|
||||
Context $context,
|
||||
Registry $registry,
|
||||
FormFactory $formFactory,
|
||||
array $data = []
|
||||
) {
|
||||
$this->_systemStore = $systemStore;
|
||||
parent::__construct($context, $registry, $formFactory, $data);
|
||||
}
|
||||
|
||||
protected function _prepareForm() {
|
||||
$model = $this->_coreRegistry->registry('olegnax_bannerslider_group');
|
||||
$form = $this->_formFactory->create();
|
||||
$fieldset = $form->addFieldset(
|
||||
'base_fieldset', ['legend' => __('General')]
|
||||
);
|
||||
|
||||
if ($model->getId()) {
|
||||
$fieldset->addField(
|
||||
'group_id', 'hidden', ['name' => 'group_id']
|
||||
);
|
||||
}
|
||||
|
||||
$fieldset->addField('group_name', 'text', array(
|
||||
'label' => __('Group name'),
|
||||
'name' => 'group_name',
|
||||
'required' => true
|
||||
));
|
||||
$fieldset->addField('identifier', 'text', array(
|
||||
'label' => __('Identifier'),
|
||||
'name' => 'identifier',
|
||||
'required' => true
|
||||
));
|
||||
$fieldset->addField('slide_width', 'text', array(
|
||||
'label' => __('Slide width'),
|
||||
'name' => 'slide_width',
|
||||
'required' => true
|
||||
));
|
||||
$fieldset->addField('slide_height', 'text', array(
|
||||
'label' => __('Slide height'),
|
||||
'name' => 'slide_height',
|
||||
'required' => true
|
||||
));
|
||||
|
||||
$data = $model->getData();
|
||||
$form->setValues($data);
|
||||
$this->setForm($form);
|
||||
|
||||
return parent::_prepareForm();
|
||||
}
|
||||
|
||||
public function getTabLabel() {
|
||||
return __('General');
|
||||
}
|
||||
|
||||
public function getTabTitle() {
|
||||
return __('General');
|
||||
}
|
||||
|
||||
public function canShowTab() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isHidden() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace Olegnax\BannerSlider\Block\Adminhtml\Group\Edit;
|
||||
|
||||
class Tabs extends \Magento\Backend\Block\Widget\Tabs {
|
||||
|
||||
protected function _construct() {
|
||||
parent::_construct();
|
||||
$this->setId( 'group_edit_tabs' );
|
||||
$this->setDestElementId( 'edit_form' );
|
||||
$this->setTitle( __( 'Group' ) );
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user