2013-12-20 47 views
0

我正在開發Magento社區版1.7版本。 我在管理中有一個網格,當我從這個網格中點擊「添加新」時,表單會出現,但它的左側有一些標籤。我需要刪除那些標籤並且只需要表單。如何刪除管理網格形式的magento中的側邊欄選項卡?

http://d.pr/i/Qa8i

應用程序/代碼/社區/命名空間/測試/座/ Adminhtml /測試/編輯/ Tabs.php

我在上面的文件標籤代碼:

protected function _beforeToHtml() { 

    $this->addTab('form_section', array(
     'label' => Mage::helper('test')->__('Book'), 
     'title' => Mage::helper('test')->__('Book'), 
     'content' => $this->getLayout()->createBlock('test/adminhtml_book_edit_tab_form')->toHtml(), 
    )); 

    return parent::_beforeToHtml();   
} 

有誰能解決這個問題嗎?以下路徑應用程序/代碼/社區/命名空間/ yourmodule /座/ Adminhtml/yourmodule /編輯/ Tabs.php checkfunction _beforeToHtml

回答

3

在管理員控制器

請參閱editAction

$this->_addContent($this->getLayout()->createBlock('<module>/adminhtml_<module>_edit')) 
        ->_addLeft($this->getLayout()->createBlock('<module>/adminhtml_<module>_edit_tabs')); 

刪除

->_addLeft($this->getLayout()->createBlock('<module>/adminhtml_<module>_edit_tabs')); 

然後創建文件名的形式。 php在

應用程序/代碼/社區/命名空間/測試/座/ Adminhtml /測試/編輯/ form.php的

並粘貼在

class <Namespace>_<Module>_Block_Adminhtml_<Module>_Edit_Form extends Mage_Adminhtml_Block_Widget_Form 
{ 
    protected function _prepareForm() 
    { 
     $<module>Form = new Varien_Data_Form(array(
      'id' => 'edit_form', 
      'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))), 
      'method' => 'post', 
     )); 
     $<module>Form->setUseContainer(true); 
     $this->setForm($<module>Form); 

     $fieldset = $<module>Form->addFieldset('<module>_form', array(
      'legend'  => Mage::helper('<module>')->__('Item Information'), 
      'class'  => 'fieldset-wide', 
      ) 
     ); 

     $fieldset->addField('<module>_name', 'text', array(
      'label'  => Mage::helper('<module>')->__('Name'), 
      'class'  => 'required-entry', 
      'required' => true, 
      'name'  => 'name', 
     )); 


     if (Mage::getSingleton('adminhtml/session')->get<Module>Data()) 
     { 
      $<module>Form -> setValues(Mage::getSingleton('adminhtml/session')->get<Module>Data()); 
      Mage::getSingleton('adminhtml/session')->get<Module>Data(null); 
     } elseif (Mage::registry('<module>_data')) { 
      $<module>Form-> setValues(Mage::registry('<module>_data')->getData()); 
     } 
     return parent::_prepareForm(); 
    } 
} 
+0

感謝這是工作良好 –

0

你好檢查()& __construct()。評論那些你想

希望這有助於你

+0

代碼我已經這樣做,但它消除標籤和形式both.I需要刪除標籤不形式。 –

相關問題