Created
October 29, 2015 15:11
-
-
Save AndreFSilveira/1eff5fa396eb21361ea1 to your computer and use it in GitHub Desktop.
Inserindo Datapicker no system.xml do Magento
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//salve as ModuleName/Block/Adminhtml/System/Config/Dataphicker.php | |
class Module_Name_Block_Adminhtml_System_Config_Datapicker extends Mage_Adminhtml_Block_System_Config_Form_Field | |
{ | |
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) | |
{ | |
$date = new Varien_Data_Form_Element_Date; | |
$format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT); | |
$data = array( | |
'name' => $element->getName(), | |
'html_id' => $element->getId(), | |
'image' => $this->getSkinUrl('images/grid-cal.gif'), | |
); | |
$date->setData($data); | |
$date->setValue($element->getValue(), $format); | |
$date->setFormat(Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)); | |
$date->setClass($element->getFieldConfig()->validate->asArray()); | |
$date->setForm($element->getForm()); | |
return $date->getElementHtml(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/.../ | |
<quotation_validate> | |
<label>Validade da cotação</label> | |
<frontend_type>text</frontend_type> | |
<frontend_model>modulename/adminhtml_system_config_datapicker</frontend_model> | |
<sort_order>20</sort_order> | |
<show_in_default>1</show_in_default> | |
<show_in_website>1</show_in_website> | |
<validate>required-entry</validate> | |
<show_in_store>1</show_in_store> | |
</quotation_validate> | |
/.../ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment