/** * @param Varien_Data_Form_Element_Abstract $element * * @return string */ public function render(Varien_Data_Form_Element_Abstract $element) { if (!extension_loaded('soap') || !extension_loaded('openssl') || !Mage::helper('bronto_common')->getApiToken()) { return null; } return parent::render($element); }
/** * Enter description here... * * @param Varien_Data_Form_Element_Abstract $element * @return string */ public function render(Varien_Data_Form_Element_Abstract $element) { $fieldConfig = $element->getFieldConfig(); $clonePath = (string) $fieldConfig->clone_path; $clonePaths = explode('/', $clonePath); // Prepare value for cloned element $name = 'groups[' . $clonePaths[1] . '][fields][' . $clonePaths[2] . '][value]'; if (isset($this->_affiliateConfigData[$clonePath])) { $data = $this->_affiliateConfigData[$clonePath]; $inherit = false; } else { $data = $this->_affiliateConfigRoot->descend($clonePath); $inherit = true; } if ($fieldConfig->backend_model) { $model = Mage::getModel((string) $fieldConfig->backend_model); if (!$model instanceof Mage_Core_Model_Config_Data) { Mage::throwException('Invalid config field backend model: ' . (string) $fieldConfig->backend_model); } $model->setPath($clonePath)->setValue($data)->afterLoad(); $data = $model->getValue(); } $element->setName($name)->setValue($data)->setInherit($inherit); // Render Element to HTML $html = parent::render($element); // Prepare Javascript for cloned element $cloneId = $element->getHtmlId(); $origId = implode('_', $clonePaths); $html .= "<script type='text/javascript'>\r\nEvent.observe(window, 'load', function() {\r\n \$('{$cloneId}').observe('change', function(){\r\n Form.Element.setValue(\$('{$origId}'), Form.Element.getValue(\$('{$cloneId}')));\r\n });\r\n \$('{$origId}').observe('change', function(){\r\n Form.Element.setValue(\$('{$cloneId}'), Form.Element.getValue(\$('{$origId}')));\r\n });"; if ($element->getCanUseWebsiteValue() || $element->getCanUseDefaultValue()) { $html .= "\r\n \$('{$cloneId}_inherit').observe('click', function(){\r\n var el = \$('{$origId}_inherit');\r\n el.checked = \$('{$cloneId}_inherit').checked;\r\n toggleValueElements(el, Element.previous(el.parentNode));\r\n });\r\n \$('{$origId}_inherit').observe('click', function(){\r\n var el = \$('{$cloneId}_inherit');\r\n el.checked = \$('{$origId}_inherit').checked;\r\n toggleValueElements(el, Element.previous(el.parentNode));\r\n });"; } $html .= "\r\n});\r\n</script>"; return $html; }
public function render(Varien_Data_Form_Element_Abstract $element) { $element->setFormat(Varien_Date::DATE_INTERNAL_FORMAT); //or other format $element->setImage($this->getSkinUrl('images/grid-cal.gif')); return parent::render($element); }
public function render(Varien_Data_Form_Element_Abstract $element) { $element->unsetData('scope'); $element->unsetData('can_use_website_value'); $element->unsetData('can_use_default_value'); return parent::render($element); }
public function render(Varien_Data_Form_Element_Abstract $element) { $this->setData('scope', $element->getScope()); // Remove the inheritance checkbox $element->unsCanUseWebsiteValue()->unsCanUseDefaultValue(); return parent::render($element); }
/** * @param Varien_Data_Form_Element_Abstract $element * * @return string */ public function render(Varien_Data_Form_Element_Abstract $element) { $realpath = str_replace('-', '/', str_replace('bronto_email_templates_', '', $element->getId())); $realValue = Mage::helper('bronto_email')->getAdminScopedConfig($realpath); $element->setValue($realValue); $element->setPath($realpath); return parent::render($element); }
public function render(Varien_Data_Form_Element_Abstract $element) { $helper = Mage::helper('netzarbeiter_groupscatalog2'); if (!$helper->getConfig('show_multiselect_field')) { $element->setComment($this->__('This field is read-only.<br/>(change the "Show multiselect customer group fields" option further down to enable this field)')); } return parent::render($element); }
/** * Enter description here... * * @param Varien_Data_Form_Element_Abstract $element * @return string */ public function render(Varien_Data_Form_Element_Abstract $element) { $countryCode = Mage::helper('paypal')->getConfigurationCountryCode(); if ($countryCode == 'DE') { return Mage::getBlockSingleton('paypal/adminhtml_System_config_field_hidden')->render($element); } return parent::render($element); }
/** * Override method to render element only if module enabled * * @param Varien_Data_Form_Element_Abstract $element * * @return String */ public function render(Varien_Data_Form_Element_Abstract $element) { // If Reward Points Module is installed if (!Mage::helper('bronto_common')->isModuleInstalled('Enterprise_CustomerBalance')) { return ''; } return parent::render($element); }
public function render(Varien_Data_Form_Element_Abstract $element) { if (!Mage::getSingleton('googletrustedstore/googleShoppingAdapter')->isActive()) { return parent::render($element); } else { return ''; } }
/** * */ public function render(Varien_Data_Form_Element_Abstract $element) { $__html = ''; if (!Mage::app()->isSingleStoreMode()) { $__html = parent::render($element); } return $__html; }
public function render(Varien_Data_Form_Element_Abstract $element) { if ($element->getScope() == "stores") { $this->setStoreId($element->getScopeId()); } // Remove the scope information so it doesn't get printed out $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue(); return parent::render($element); }
public function render(Varien_Data_Form_Element_Abstract $element) { if ($this->getRequest()->getParam('website') != '') { if (Mage::app()->getStore()->getConfig('general/price/scope') == Mage_Core_Model_Store::PRICE_SCOPE_GLOBAL) { return ''; } } return parent::render($element); }
/** * @param Varien_Data_Form_Element_Abstract $_element * @return string */ public function render(Varien_Data_Form_Element_Abstract $_element) { $_html = parent::render($_element); $_html .= '<tr style="display: none;"><td>'; $_script = "<script type=\"text/javascript\">new MaskedInput('#" . $_element->getHtmlId() . "', '99:99')</script>"; $_html .= $_script; $_html .= '</td></tr>'; return $_html; }
public function render(Varien_Data_Form_Element_Abstract $element) { if ($this->getRequest()->getParam('website') != '') { $priceScope = AO::app()->getStore()->getConfig(Mage_Core_Model_Store::XML_PATH_PRICE_SCOPE); if ($priceScope == Mage_Core_Model_Store::PRICE_SCOPE_GLOBAL) { return ''; } } return parent::render($element); }
public function render(Varien_Data_Form_Element_Abstract $element) { $html = parent::render($element); /** @var Aoe_ConfigHelper_Helper_Data $helper */ $helper = Mage::helper('Aoe_ConfigHelper'); if ($helper->getConfigPathHintsActive()) { $configCode = $this->getConfigCode($element); $id = str_replace('/', '_', $configCode); $prompt = 'onclick="var v=$(\'' . $id . '\').getValue(); window.prompt(\'Copy\', \'' . $configCode . ' = \' + v)"'; $html = str_replace("<label for=", "<label {$prompt} for=", $html); } return $html; }
/** * If cannot display fields, display error message * * @param Varien_Data_Form_Element_Abstract $element * @return string|false */ public function render(Varien_Data_Form_Element_Abstract $element) { $version = Mage::getVersion(); if (version_compare($version, '1.4.2.0', '<') && version_compare($version, '1.3.0.0', '>')) { if (self::$_singleton === false) { self::$_singleton = true; return '<tr> <td class="comment" colspan="3"><em>This feature is not supported with your version of Magento.</em></td> </tr>'; } return false; } return parent::render($element); }
public function render(Varien_Data_Form_Element_Abstract $element) { $elementId = $element->getHtmlId(); $optionShoppingCartId = str_replace('/', '_', Mage_Persistent_Helper_Data::XML_PATH_PERSIST_SHOPPING_CART); $optionEnabled = str_replace('/', '_', Mage_Persistent_Helper_Data::XML_PATH_ENABLED); $addInheritCheckbox = false; if ($element->getCanUseWebsiteValue()) { $addInheritCheckbox = true; } elseif ($element->getCanUseDefaultValue()) { $addInheritCheckbox = true; } $html = '<script type="text/javascript"> PersistentCustomerSegmentation = Class.create(); PersistentCustomerSegmentation.prototype = { initialize : function () { this._element = $("' . $elementId . '"); var funcTrackOnChangeShoppingCart = this.trackOnChangeShoppingCart.bind(this); document.observe("dom:loaded", funcTrackOnChangeShoppingCart); $("' . $optionShoppingCartId . '").observe("change", funcTrackOnChangeShoppingCart); $("' . $optionEnabled . '").observe("change", function() { setTimeout(funcTrackOnChangeShoppingCart, 1); });' . ($addInheritCheckbox ? '$("' . $elementId . '_inherit").observe("change", funcTrackOnChangeShoppingCart);' : '') . '}, disable: function() { this._element.disabled = true; this._element.value = 1; }, enable: function() { this._element.disabled = false; }, trackOnChangeShoppingCart: function() { if ($("' . $optionEnabled . '").value == 1 && $("' . $optionShoppingCartId . '").value == 1 ) { this.disable(); } else { ' . ($addInheritCheckbox ? 'if ($("' . $elementId . '_inherit").checked) { this.disable(); } else { this.enable(); }' : 'this.enable();') . ' } } }; var persistentCustomerSegmentation = new PersistentCustomerSegmentation(); </script>'; return parent::render($element) . $html; }
/** * Enter description here... * * @param Varien_Data_Form_Element_Abstract $element * @return string */ public function render(Varien_Data_Form_Element_Abstract $element) { $hint = (array) $element->getFieldConfig()->hint; if (!count($hint)) { return parent::render($element); } // Generate Tooltip /** @var $tooltip Payone_Core_Block_Adminhtml_System_Config_Tooltip */ $tooltip = $this->getLayout()->createBlock('payone_core/adminhtml_system_config_tooltip'); $tooltip->initFormElement($element); $tooltipHtml = $tooltip->toHtml(); $element->setHint('__tooltip_html__'); $html = parent::render($element); $hintToReplace = '<div class="hint" ><div style="display: none;">__tooltip_html__</div></div>'; $html = str_replace($hintToReplace, $tooltipHtml, $html); return $html; }
/** * Render media chooser buttons and image preview HTML after the element * Add some JS in order to disable buttons if inherit checkbox is checked * * @param Varien_Data_Form_Element_Abstract $element * @return string */ public function render(Varien_Data_Form_Element_Abstract $element) { $element = Mage::helper('mediachooserfield')->render($element); $html = parent::render($element); $html .= ' <script type="text/javascript"> //<![CDATA[ var inheritCheckbox = $(\'' . $element->getId() . '_inherit\'); if(inheritCheckbox && inheritCheckbox.checked) { $$(\'#buttons_' . $element->getId() . ' button\').each(function(el) { el.addClassName(\'disabled\'); el.setAttribute(\'disabled\', \'disabled\'); }); $(\'' . $element->getId() . '\').addClassName(\'disabled\').disable(); } //]]> </script> '; return $html; }
public function render(Varien_Data_Form_Element_Abstract $element) { $html = parent::render($element); $fc = (array) $element->getData('field_config'); if (isset($fc['depend_fields']) && ($dependFields = (array) $fc['depend_fields'])) { foreach ($dependFields as &$dv) { $dv = explode(',', $dv); } $dfJson = Zend_Json::encode($dependFields); $html .= <<<EOT <script type="text/javascript"> document.observe("dom:loaded", function() { \tvar df = \$H({$dfJson}) \t\$('{$element->getHtmlId()}')['syncDependFields'] = function() { \t df.each(function(pair){ \t\t\tif (\$(pair.key) && (trElem = \$(pair.key).up("tr"))) { \t\t\t\tif (\$A(pair.value).indexOf(\$('{$element->getHtmlId()}').value) != -1) { \t\t\t\t\ttrElem.show(); \t\ttrElem.select('select').invoke('enable'); \t\ttrElem.select('input').invoke('enable'); \t\ttrElem.select('textarea').invoke('enable'); \t} else { \t\ttrElem.hide(); \t\ttrElem.select('select').invoke('disable'); \t\ttrElem.select('input').invoke('disable'); \t\ttrElem.select('textarea').invoke('disable'); \t} \tif (\$(pair.key)['syncDependFields']) { \t \$(pair.key)['syncDependFields'].defer(); } \t\t\t} \t\t}) \t} \$('{$element->getHtmlId()}').observe('change', \$('{$element->getHtmlId()}')['syncDependFields']); \$('{$element->getHtmlId()}')['syncDependFields'].defer(); }) </script> EOT; } return $html; }
/** * Render country field considering request parameter * * @param Varien_Data_Form_Element_Abstract $element * @return string */ public function render(Varien_Data_Form_Element_Abstract $element) { $country = $this->getRequest()->getParam(self::REQUEST_PARAM_COUNTRY); if ($country) { $element->setValue($country); } if ($element->getCanUseDefaultValue()) { $defaultConfigNode = Mage::getConfig()->getNode(null, 'default'); if ($defaultConfigNode) { $this->_defaultCountry = (string) $defaultConfigNode->descend('paypal/general/merchant_country'); } if (!$this->_defaultCountry) { $this->_defaultCountry = Mage::helper('core')->getDefaultCountry(); } if ($country) { $shouldInherit = $country == $this->_defaultCountry && $this->getRequest()->getParam(self::REQUEST_PARAM_DEFAULT); $element->setInherit($shouldInherit); } if ($element->getInherit()) { $this->_defaultCountry = null; } } return parent::render($element); }
public function render(Varien_Data_Form_Element_Abstract $element) { // Only show the current scope hasn't been configured yet switch ($element->getScope()) { case "stores": if ($this->hasApiKeys($element->getScopeId())) { return ""; } break; case "websites": $website = Mage::app()->getWebsite($element->getScopeId()); if ($this->hasApiKeys($website->getStores())) { return ""; } break; default: if ($this->hasApiKeys()) { return ""; } } // Remove the scope information so it doesn't get printed out $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue(); return parent::render($element); }
public function render(Varien_Data_Form_Element_Abstract $element) { $html = parent::render($element); $html .= <<<EOT <script type="text/javascript"> document.observe("dom:loaded", function() { \$('{$element->getHtmlId()}').observe('change', function(e){ var el = e.element() sync_nl2customchar_fields(el) }) sync_nl2customchar_fields(\$('{$element->getHtmlId()}')) }) function sync_nl2customchar_fields(el) { var stEl = \$(el.id+'_value') if (el.value==0) { stEl.disable() } else { stEl.enable() } } </script> EOT; return $html; }
public function render(Varien_Data_Form_Element_Abstract $element) { $html = parent::render($element); $fc = (array) $element->getData('field_config'); if (isset($fc['depend_value']) && isset($fc['depend_field']) && ($df = $fc['depend_field'])) { if (!is_array($df)) { $df = explode(',', $df); } $dfJson = Zend_Json::encode($df); $dfValueJson = Zend_Json::encode($fc['depend_value']); $html .= <<<EOT <script type="text/javascript"> document.observe("dom:loaded", function() { \tvar df = \$A({$dfJson}) \tvar dfVal = {$dfValueJson} \tvar syncDependFields = function() { \t\tfor (i=0; i<df.size(); i++) { \t\t\tif (\$(df[i])) { \t\t\t\tif (\$('{$element->getHtmlId()}').value == dfVal) { \t\t\t\t\t\$(df[i]).up("tr").show() \t\t\$(df[i]).enable() \t} else { \t\t\$(df[i]).up("tr").hide() \t\t\$(df[i]).disable() \t} \t\t\t} \t\t} \t} \$('{$element->getHtmlId()}').observe('change', syncDependFields) syncDependFields() }) </script> EOT; } return $html; }
/** * Remove scope label * * @param Varien_Data_Form_Element_Abstract $element * @return string */ public function render(Varien_Data_Form_Element_Abstract $element) { $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue(); return parent::render($element); }
/** * Remove the "scope" value * * @param Varien_Data_Form_Element_Abstract $element * * @return string */ public function render(Varien_Data_Form_Element_Abstract $element) { $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue(); $element->setLabel($this->_getButtonHtml($element)); return parent::render($element); }
/** * @param Varien_Data_Form_Element_Abstract $element * * @return string */ public function render(Varien_Data_Form_Element_Abstract $element) { $this->_currentElement = $element; return parent::render($element); }
/** * Unset scope label and pass further to parent render() * * @param Varien_Data_Form_Element_Abstract $element * @return string */ public function render(Varien_Data_Form_Element_Abstract $element) { // Unset the scope label near the button $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue(); return parent::render($element); }