So I have a methodology that works fine but I have a distinct feeling there is a totally different way, more Magentoriffic way to do this.
I have an admin module with a tabbed form. In one of the tabs, I want a small form to reside just above a grid. I have done it by doing a simple append on the blocks with a period as shown below.
Works great, no errors, no exceptions, but I have not seen this methodology anywhere else in Magento.
So, I am on a quest to determine the Magento way of doing this. Here is my code:
$this->addTab('directory_content', array(
'label' => Mage::helper('businessdirectory')->__('Listings'),
'title' => Mage::helper('businessdirectory')->__('Listings'),
'content' => $this->getLayout()->createBlock('businessdirectory/adminhtml_directories_edit_tab_listing')->toHtml().
$this->getLayout()->createBlock('businessdirectory/adminhtml_directories_edit_tab_listing_grid')->toHtml()
));
Best Answer
What you could do is use
url
instead ofcontent
. This will fill the content with a call to a specific url, in this way you can then use a controller rendering layout via xml so that the whole thing becomes more expendable.A perfect example of this is the catalog and how you can add categories and other products such as upselling and cross selling to products. Check out
app/code/core/Mage/Adminhtml/Block/Catalog/Product/Edit/Tabs.php
and see how it is done there.Though I am not saying that either is more "Magentoriffic"