*/ class Varien_Data_Form_Element_Image extends Varien_Data_Form_Element_Abstract { /** * Enter description here... * * @param array $data */ public function __construct($data) { parent::__construct($data); $this->setType('file'); } /** * Enter description here... * * @return string */ public function getElementHtml() { $html = ''; if ($this->getValue()) { $url = $this->_getUrl(); if( !preg_match("/^http\:\/\/|https\:\/\//", $url) ) { $url = Mage::getBaseUrl('media') . $url; } $html = ''.$this->getValue().' '; } $this->setClass('input-file'); $html.= parent::getElementHtml(); $html.= $this->_getDeleteCheckbox(); return $html; } /** * Enter description here... * * @return string */ protected function _getDeleteCheckbox() { $html = ''; if ($this->getValue()) { $label = Mage::helper('core')->__('Delete Image'); $html .= ''; $html .= 'getDisabled() ? ' disabled="disabled"': '').'/>'; $html .= ''; $html .= $this->_getHiddenInput(); $html .= ''; } return $html; } /** * Enter description here... * * @return string */ protected function _getHiddenInput() { return ''; } /** * Get image preview url * * @return string */ protected function _getUrl() { return $this->getValue(); } /** * Enter description here... * * @return string */ public function getName() { return $this->getData('name'); } }