For this, you need to overwrite this class Mage_Adminhtml_Block_Cms_Block_Edit_Form
. This class is used to add fieldsets and fields for cms_block
. Take a look on the _prepareForm()
method inside it.
If you put this code, just after Title
field,
$fieldset->addField('sub_title', 'text', array(
'name' => 'sub_title',
'label' => Mage::helper('cms')->__('Sub Title'),
'title' => Mage::helper('cms')->__('Sub Title'),
'required' => true,
));
you can see your sub-title
text field in static blocks. However Do not edit a core file directly. You need to write a custom module that should overwrite this class. Your Module config file should contain this code
File : app/code/local/Namespace/Module/etc/config.xml
<config>
<global>
<blocks>
<adminhtml>
<rewrite>
<cms_block_edit_form>Namespace_Module_Block_Adminhtml_Cms_Block_Edit_Form</cms_block_edit_form>
</rewrite>
</adminhtml>
</blocks>
</global>
</config>
This will allow you to rewrite the class. What you need to do now is define the rewrite class now and in there you need to rewrite _prepareForm()
. It should some what look like this.
Location : app/code/local/Namespace/Module/Block/Adminhtml/Cms/Block/Edit/Form.php
<?php
class Namespace_Module_Block_Adminhtml_Cms_Block_Edit_Form extends Mage_Adminhtml_Block_Cms_Block_Edit_Form {
protected function _prepareForm()
{
//put all the code inside parent class here
//then place the below content in appropriate place
$fieldset->addField('sub_title', 'text', array(
'name' => 'sub_title',
'label' => Mage::helper('cms')->__('Sub Title'),
'title' => Mage::helper('cms')->__('Sub Title'),
'required' => true,
));
return parent::_prepareForm();
}
}
Try based on this idea
EDIT
Please note, it will allow you to put new field in cms > block
, howver to save this, you need to define model for your module. You have two options. Add a new field to save your new field in Cms > Block table or create your own table and store this value in that field along with the referene to cms >block table. This is out of box and you should implement it your own way.