edit grid
牵扯到form的问题,明晚在详细研究。今天吧结构理理。
1.
<profile_adminhtml_profile_edit>
<update handle="editor"/>
<reference name="content">
<block type="profile/adminhtml_profile_edit" name="profile_edit"></block>
</reference>
<reference name="left">
<block type="profile/adminhtml_profile_edit_tabs" name="profile_edit_tabs">
<block type="profile/adminhtml_profile_edit_tab_main" name="profile_edit_tab_main" />
<block type="profile/adminhtml_profile_edit_tab_meta" name="profile_edit_tab_meta" />
<action method="addTab"><name>main_section</name><block>profile_edit_tab_main</block></action>
<action method="addTab"><name>meta_section</name><block>profile_edit_tab_meta</block></action>
</block>
</reference>
</profile_adminhtml_profile_edit>
结构为:content(profile_edit)里面包含left(profile_edit_tabs) 和form,form是个空间,在content中存在
大致这样。
2
<block type="profile/adminhtml_profile_edit" name="profile_edit"></block>
template
widget/form/container.phtml
type对应的 RichardMason_Profile_Block_Adminhtml_Profile_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
其实就是一个widget-form-container
3
RichardMason_Profile_Block_Adminhtml_Profile_Edit
public function __construct()
{
$this->_objectId = 'profile_id';
$this->_blockGroup = 'profile';
$this->_controller = 'adminhtml_profile';
parent::__construct();
$this->addButton();
public function getHeaderText()
protected function _isAllowedAction($action)
4
$this->getFormHtml()
<div class="entry-edit">
<?php echo $this->getFormHtml();?>
</div>
public function getFormHtml()
{ //$this->_children[$name];
$this->getChild('form')->setData('action', $this->getSaveUrl());
return $this->getChildHtml('form');
}
class RichardMason_Profile_Block_Adminhtml_Profile_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
{
protected function _prepareForm()
{
$form = new Varien_Data_Form(array('id' => 'edit_form', 'action' => $this->getData('action'), 'method' => 'post', 'enctype' => 'multipart/form-data'));
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
}