0

In admin configuration I have a section that has groups and fields. To one of those fields I'm doing some custom stuff via the <frontend_model> in _getElementHtml()

Is there a way to retrieve the module or extension name of the current extension within that function?

<sections>
    <extensionname translate="label" module="extensionname">
        <label>Extension Name</label>

sorry if my question isn't very clear... I know what I'm trying to do but stumbling in how to ask.

4

1 回答 1

0

我不确定这是否有助于我让我的问题更清楚,但这是我最终想出的解决方案......

protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element){
    $modules = Mage::getConfig()->getNode('modules')->children();
    $modulesArray = (array)$modules;

    $module = '';
    foreach($modulesArray as $k => $v){
        if(strpos(strtolower($k), $this->getRequest()->getParam('section')) !== false){
            $module = $k;
        };
    }

本质上我想获得扩展或“模块”名称,以便稍后在代码中我可以调用它

Mage::getConfig()->getNode()->modules->$module->version

这样我就不必在扩展名或模块名中硬编码它可能是动态的......

如果....有更好的方法可以做到这一点,请让我知道,因为我只是通过这个大声笑。

于 2013-07-15T20:22:32.333 回答