protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) { $elementId = $element->getHtmlId(); preg_match("/[^_\\W]+\$/", $elementId, $fileName); //Grab last word $moduleName = Mage::helper('dpd/data')->module; //getModule name $newElement = str_replace($moduleName, "", $elementId); //remove module name from string $newElement = str_replace($fileName[0], "", $newElement); //remove file name from string $elementName = trim($newElement, "_"); $url = Mage::helper("adminhtml")->getUrl("dpd/adminhtml_buttons/export", array('element' => $elementName, 'fileName' => $fileName[0], 'scope' => $this->getForm()->getScope(), 'scope_id' => $this->getForm()->getScopeId())); $label = $element->getFieldConfig()->button_label->__toString(); if (empty($label)) { $label = trim($element->getLabel()); } $html = $this->getLayout()->createBlock('adminhtml/widget_button')->setId($elementId)->setType($element->gettype())->setLabel(__($label))->setOnClick("setLocation('{$url}')")->toHtml(); return $html; }