Finn this case, you need to create class
for your custom input field
Videos
at magento library folder location lib/Varien/Data/Form/Element
Here you find list of input files relative class
.
For case of view,you need to create the
<?php
class Varien_Data_Form_Element_Video extends Varien_Data_Form_Element_Abstract {
public function __construct($data) {
parent::__construct($data);
$this->setType('file');
}
public function getElementHtml() {
$html = '';
if ($this->getValue()) {
$url = $this->_getUrl();
if( !preg_match("/^http\:\/\/|https\:\/\//", $url) ) {
$url = Mage::getBaseUrl('media') . $url;
}
$html = '<a href="'.$url.'" onclick="VideoPreview(\''.$this->getHtmlId().'_video\'); return false;"><img src="'.$url.'" id="'.$this->getHtmlId().'_video" title="'.$this->getValue().'" alt="'.$this->getValue().'" height="22" width="22" /></a> ';
}
$this->setClass('input-file');
$html.= parent::getElementHtml();
$html.= $this->_getDeleteCheckbox();
return $html;
}
protected function _getDeleteCheckbox() {
$html = '';
if ($this->getValue()) {
$label = Mage::helper('core')->__('Delete video');
$html .= '<span>';
$html .= '<input type="checkbox" name="'.parent::getName().'[delete]" value="1" id="'.$this->getHtmlId().'_delete"'.($this->getDisabled() ? ' disabled="disabled"': '').'/>';
$html .= '<label for="'.$this->getHtmlId().'_delete"'.($this->getDisabled() ? '' : '').'> '.$label.'</label>';
$html .= $this->_getHiddenInput();
$html .= '</span>';
}
return $html;
}
protected function _getHiddenInput() {
return '<input type="hidden" name="'.parent::getName().'[value]" value="'.$this->getValue().'" accept="video/*" />';
}
protected function _getUrl() {
return $this->getValue();
}
public function getName() {
return $this->getData('name');
}
}