*/ class Mage_XmlConnect_Block_Adminhtml_Mobile_Form_Element_Image extends Varien_Data_Form_Element_Image { /** * Function fetches image Url actual or default * * @return string */ protected function _getUrl() { if ($this->getValue()) { if (strpos($this->getValue(), '://') === false) { $url = Mage::helper('xmlconnect/image')->getFileDefaultSizeSuffixAsUrl($this->getValue()); $url = Mage::helper('xmlconnect/image')->getMediaUrl($url); } else { $url = $this->getValue(); } } else { $url = $this->getDefaultValue(); } return $url; } /** * Get "clear" filename from element * * @return string */ public function getUploadName() { /** * Ugly hack to avoid $_FILES[..]['name'][..][..] */ $name = $this->getName(); $name = strtr($name, array('[' => '/', ']' => '')); return $name; } /** * Compose output html for element * * @return string */ public function getElementHtml() { $html = '
'; $url = $this->_getUrl(); $html .= ''; $html .= 'getHtmlId() . '_hidden" name="' . $this->getName(); $html .= '" value="' . $this->getEscapedValue() . '" type="hidden" />'; $this->setClass('input-file'); $html .= '' . PHP_EOL; $html .= $this->getAfterElementHtml(); $html .= '
'; return $html; } }