最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
magento2 后台开发 Grid curd内容增删改查
时间:2015-05-22 编辑:简简单单 来源:一聚教程网
magento2 后台开发 Grid curd内容增删改查
继续基于我们的helloword插件,根据建立的grid, 对内容crud
一:添加内容 controller
app/code/Magento/HelloWord/Controller/Adminhtml/Manage/Save.php
namespace Magento\HelloWord\Controller\Adminhtml\Manage;
class NewAction extends \Magento\Backend\App\Action
{
public function execute()
{
$this->_forward('edit');
}
}
二:edit block 显示form app/code/Magento/HelloWord/Block/Adminhtml/Bannerslider/Edit.php
namespace Magento\HelloWord\Block\Adminhtml\Bannerslider;
/**
* CMS block edit form container
*/
class Edit extends \Magento\Backend\Block\Widget\Form\Container
{
protected function _construct()
{
$this->_objectId = 'id';
$this->_blockGroup = 'Magento_HelloWord';
$this->_controller = 'adminhtml_helloword;
parent::_construct();
$this->buttonList->update('save', 'label', __('Save Image'));
$this->buttonList->update('delete', 'label', __('Delete Image'));
$this->buttonList->add(
'saveandcontinue',
array(
'label' => __('Save and Continue Edit'),
'class' => 'save',
'data_attribute' => array(
'mage-init' => array('button' => array('event' => 'saveAndContinueEdit', 'target' => '#edit_form'))
)
),
-100
);
$this->_formScripts[] = "
function toggleEditor() {
if (tinyMCE.getInstanceById('block_content') == null) {
tinyMCE.execCommand('mceAddControl', false, 'hello_content');
} else {
tinyMCE.execCommand('mceRemoveControl', false, 'hello_content');
}
}
";
}
/**
* Get edit form container header text
*
* @return string
*/
public function getHeaderText()
{
if ($this->_coreRegistry->registry('helloword_helloword')->getId()) {
return __("Edit Item '%1'", $this->escapeHtml($this->_coreRegistry->registry('helloword_helloword')->getTitle()));
} else {
return __('New Item');
}
}
}
-
下一个: javascript匹配车牌号正则表达式
相关文章
- HTML简单购物数量小程序代码展示 10-31
- html canvas实现弹幕功能 10-31
- HTML中空格表示的意义 10-31
- html area标签解读 10-31
- html使用表单标签实现注册页面代码展示 10-31
- 使用HTML截图并保存为本地图片的代码展示 10-31