系统配置中的字段集-Magento管理模块 [英] Fieldset in system configuration - Magento Admin module

查看:52
本文介绍了系统配置中的字段集-Magento管理模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个管理模块.我有一组字段,我想在系统配置中为3个字段分别创建一个字段集,我已经创建了字段,但想在其中添加字段集. 任何帮助,将不胜感激.谢谢

I am creating an admin module. I have set of fields and i want to create a fieldset each of 3 fields in system configuration, i have created fields but wanted to add fieldset in it. Any help would be appreciated. Thank you

推荐答案

无论您是在代码中还是在.phtml中添加字段,您都没有给出太多信息,即模块的布局,但这就是我向字段中添加字段的方式.字段集:

You haven't given much information i.e Layout of your module, whether you are adding fields in code or .phtml but this is how I am adding fields to a field set:

protected function _prepareForm()
{
    $form = new Varien_Data_Form();
    $this->setForm($form);

    $fieldset = $form->addFieldset('form_settings', array('legend'=>Mage::helper('mymodule')->__('Module Settings')));

    $newFieldset = $fieldset->addFieldset('form_settings_test', array('legend'=>Mage::helper('khaosconnect')->__('Order Settings')));

    $newFieldset->addField('mysetting1', 'text', array(
        'label'     => Mage::helper('mymodule')->__('Setting 1'),
        'class'     => 'required-entry',
        'required'  => true,
        'name'      => 'mysetting1',
        'value'     => "val1",
        'style'     => 'width:500px'
    ));

    $newFieldset->addField('mysetting2', 'text', array(
        'label'     => Mage::helper('mymodule')->__('Setting 2'),
        'class'     => 'required-entry',
        'required'  => true,
        'name'      => 'mysetting2',
        'value'     => "val2",
        'style'     => 'width:500px'
    ));
}

已更新以显示嵌套的字段集.

Updated to show nested fieldsets.

这篇关于系统配置中的字段集-Magento管理模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆