Public Member Functions | |
render (Varien_Data_Form_Element_Abstract $element) | |
Protected Member Functions | |
_getElementHtml (Varien_Data_Form_Element_Abstract $element) |
Definition at line 35 of file Field.php.
_getElementHtml | ( | Varien_Data_Form_Element_Abstract $ | element | ) | [protected] |
Enter description here...
Varien_Data_Form_Element_Abstract | $element |
Reimplemented in Mage_Adminhtml_Block_Catalog_Form_Renderer_Config_DateFieldsOrder, Mage_Adminhtml_Block_Catalog_Form_Renderer_Config_YearRange, Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract, Mage_Adminhtml_Block_System_Config_Form_Field_Datetime, Mage_Adminhtml_Block_System_Config_Form_Field_Notification, Mage_Adminhtml_Block_System_Config_Form_Field_Select_Flatcatalog, Mage_Adminhtml_Block_System_Config_Form_Field_Select_Flatproduct, Mage_AmazonPayments_Block_Adminhtml_Shipping_Methods, Mage_Directory_Block_Adminhtml_Frontend_Region_Updater, Mage_GoogleCheckout_Block_Adminhtml_Shipping_Applicable_Countries, Mage_GoogleCheckout_Block_Adminhtml_Shipping_Merchant, and Mage_Tax_Block_Adminhtml_Frontend_Region_Updater.
Definition at line 46 of file Field.php.
render | ( | Varien_Data_Form_Element_Abstract $ | element | ) |
Enter description here...
Varien_Data_Form_Element_Abstract | $element |
Implements Varien_Data_Form_Element_Renderer_Interface.
Reimplemented in Mage_Directory_Block_Adminhtml_Frontend_Currency_Base.
Definition at line 57 of file Field.php.
00058 { 00059 $id = $element->getHtmlId(); 00060 00061 $html = '<tr><td class="label"><label for="'.$id.'">'.$element->getLabel().'</label></td>'; 00062 00063 //$isDefault = !$this->getRequest()->getParam('website') && !$this->getRequest()->getParam('store'); 00064 $isMultiple = $element->getExtType()==='multiple'; 00065 00066 // replace [value] with [inherit] 00067 $namePrefix = preg_replace('#\[value\](\[\])?$#', '', $element->getName()); 00068 00069 $options = $element->getValues(); 00070 00071 $addInheritCheckbox = false; 00072 if ($element->getCanUseWebsiteValue()) { 00073 $addInheritCheckbox = true; 00074 $checkboxLabel = Mage::helper('adminhtml')->__('Use website'); 00075 } 00076 elseif ($element->getCanUseDefaultValue()) { 00077 $addInheritCheckbox = true; 00078 $checkboxLabel = Mage::helper('adminhtml')->__('Use default'); 00079 } 00080 00081 if ($addInheritCheckbox) { 00082 $inherit = $element->getInherit()==1 ? 'checked="checked"' : ''; 00083 if ($inherit) { 00084 $element->setDisabled(true); 00085 } 00086 } 00087 00088 $html.= '<td class="value">'; 00089 $html.= $this->_getElementHtml($element); 00090 if ($element->getComment()) { 00091 $html.= '<p class="nm"><small>'.$element->getComment().'</small></p>'; 00092 } 00093 $html.= '</td>'; 00094 if ($addInheritCheckbox) { 00095 00096 $defText = $element->getDefaultValue(); 00097 if ($options) { 00098 $defTextArr = array(); 00099 foreach ($options as $k=>$v) { 00100 if ($isMultiple) { 00101 if (is_array($v['value']) && in_array($k, $v['value'])) { 00102 $defTextArr[] = $v['label']; 00103 } 00104 } elseif ($v['value']==$defText) { 00105 $defTextArr[] = $v['label']; 00106 break; 00107 } 00108 } 00109 $defText = join(', ', $defTextArr); 00110 } 00111 00112 // default value 00113 $html.= '<td class="use-default">'; 00114 //$html.= '<input id="'.$id.'_inherit" name="'.$namePrefix.'[inherit]" type="checkbox" value="1" class="input-checkbox config-inherit" '.$inherit.' onclick="$(\''.$id.'\').disabled = this.checked">'; 00115 $html.= '<input id="'.$id.'_inherit" name="'.$namePrefix.'[inherit]" type="checkbox" value="1" class="checkbox config-inherit" '.$inherit.' onclick="toggleValueElements(this, Element.previous(this.parentNode))" /> '; 00116 $html.= '<label for="'.$id.'_inherit" class="inherit" title="'.htmlspecialchars($defText).'">'.$checkboxLabel.'</label>'; 00117 $html.= '</td>'; 00118 } 00119 00120 $html.= '</tr>'; 00121 return $html; 00122 }