本文整理汇总了PHP中Mage_Adminhtml_Block_System_Config_Form_Field::_getElementHtml方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Adminhtml_Block_System_Config_Form_Field::_getElementHtml方法的具体用法?PHP Mage_Adminhtml_Block_System_Config_Form_Field::_getElementHtml怎么用?PHP Mage_Adminhtml_Block_System_Config_Form_Field::_getElementHtml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Adminhtml_Block_System_Config_Form_Field
的用法示例。
在下文中一共展示了Mage_Adminhtml_Block_System_Config_Form_Field::_getElementHtml方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getElementHtml
/**
* Override method to output our custom HTML with JavaScript
*
* @param Varien_Data_Form_Element_Abstract $element
*
* @return String
*/
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$_html = array();
$element->setData('after_element_html', "\n <span id=\"classpath-loadingmask\" style=\"display: none; width: 100px;\">\n <span class=\"loader\" id=\"classpath-loading-mask-loader\" style=\"background: url(" . $this->getSkinUrl('bronto/images/ajax-loader-tr.gif') . ") no-repeat 0 50%; background-size: 20px; padding:3px 0 3px 25px;\">" . $this->__(' Searching For Class Path...') . "</span>\n <span id=\"classpath-loading-mask\"></span>\n </span>\n\n <script>\n //<![CDATA[\n Event.observe(window, 'load', function() {\n var newTr = '<tr id=\"bronto_verify_advanced_classpath_results\"><td class=\"classpath_results\" colspan=\"4\"><div id=\"bronto-classpath-results\"></div></td></tr>';\n \$('" . $this->_getRowElementId($element) . "').insert({after: newTr});\n });\n function searchClasspath() {\n var reloadUrl = '{$this->getUrl('*/advanced/ajaxclasspath')}';\n var statusText = \$('bronto-classpath-results');\n\n var searchText = \$('bronto_verify_advanced_classpath_search').value;\n var classType = \$('classpath-type').value;\n\n statusText.innerHTML = \$('classpath-loadingmask').innerHTML;\n\n new Ajax.Request(reloadUrl, {\n method: 'post',\n parameters: {class: searchText, type: classType},\n onComplete: function(transport) {\n Element.hide('classpath-loadingmask');\n statusText.innerHTML = transport.responseText;\n }\n });\n\n return false;\n }\n //]]>\n </script>\n ");
// Add Class Type Selector to Input
$classTypeHtml = '<select id="classpath-type"><option value="model">Model (Default)</option><option value="helper">Helper</option><option value="block">Block</option><option value="controller">Controller</option></select>';
// Add Search Button
$button = $this->getLayout()->createBlock('bronto_verify/adminhtml_widget_button_classpath')->toHtml();
$buttonHtml = "<p class=\"form-buttons\" id=\"events-button\" style=\"float:none;\">{$button}</p>";
// Add Button to Html
$_html[] = $buttonHtml;
// Show everything Else
if (!empty($_html)) {
$elementHtml = $element->getElementHtml();
$elementHtml .= $classTypeHtml;
if ($element->getComment()) {
$elementHtml .= '<p class="note"><span>' . $element->getComment() . '</span></p>';
$element->setComment(null);
}
$elementHtml .= '<div style="margin-top:10px">';
$elementHtml .= implode('<br />', $_html);
$elementHtml .= '</div>';
return $elementHtml;
}
return parent::_getElementHtml($element);
}
示例2: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$element->setData('onchange', "apiValidation(this.form, this);");
$url = Mage::helper('adminhtml')->getUrl('*/connector/ajaxvalidation');
$element->setData('after_element_html', "\n <script>\n document.observe('dom:loaded', function(){\n apiValidation();\n\n });\n function apiValidation(form, element) {\n var api_user = \$('connector_transactional_emails_credentials_api_username');\n var api_password = \$('connector_transactional_emails_credentials_api_password');\n var reloadurl = '{$url}';\n var encoded = btoa(api_password.value);\n new Ajax.Request(reloadurl, {\n method: 'post',\n parameters: {'api_username' : api_user.value, 'api_password' : encoded},\n onComplete: function(transport) {\n Element.hide('loadingmask');\n if(transport.responseText == '\"Credentials Valid.\"'){\n api_user.setStyle({\n fontWeight: 'bold',\n color: 'green' ,\n background: 'transparent url(\"" . $this->getSkinUrl('images/success_msg_icon.gif') . "\") no-repeat right center'\n })\n }else{\n api_user.setStyle({\n fontWeight: 'bold',\n color: 'red',\n background: 'transparent url(\"" . $this->getSkinUrl('images/error_msg_icon.gif') . "\") no-repeat right center'\n });\n\n }\n }\n });\n\n return false;\n }\n\n </script>\n ");
return parent::_getElementHtml($element);
}
示例3: _getElementHtml
/**
* Override field method to add js
*
* @param Varien_Data_Form_Element_Abstract $element
* @return String
*/
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
// Get the default HTML for this option
$html = parent::_getElementHtml($element);
$html .= '<script>jQuery(function(){ jQuery("#' . $element->getHtmlId() . '").attr("style", "width: 200px !important").attr("data-hex", true).mColorPicker({ imageFolder: "' . $this->getJsUrl('olegnax/mColorPicker/') . '" }); });</script>';
return $html;
}
示例4: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
// Get the default HTML for this option
$output = parent::_getElementHtml($element);
// return $output;
return $this->_getUrl();
}
示例5: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$extra = '';
if ($current_store = Mage::app()->getRequest()->getParam('store')) {
$store = Mage::getModel('core/store')->load($current_store);
$url = parse_url($store->getBaseUrl());
$host = $url['host'];
//$ok = Mage::getStoreConfig('j2tonecheckout/'.base64_decode("bW9kdWxlX3NlcmlhbA==").'/ok', $store->getId());
/*$ok = Mage::getStoreConfig('rewardpoints/verser/ok', $store->getId());
if ($ok === null){
$extra = '<div style="color:red;">'.Mage::helper('rewardpoints')->__('Please insert / verify your serial for "%s" domain', $host).'</div>';
} else if ($ok === "0"){
$extra = '<div style="color:red;">'.Mage::helper('rewardpoints')->__('Serial is not valid for "%s" domain', $host).'</div>';
} else if ($ok == "1"){
$extra = '<div style="color:green;">'.Mage::helper('rewardpoints')->__('Serial is valid for "%s" domain', $host).'</div>';
}*/
$extra = '<div>' . Mage::helper('rewardpoints')->__("Serial defined for store domain '%s'", $host) . '</div>';
} else {
$websites = Mage::app()->getWebsites();
$code = Mage::app()->getWebsite(true)->getDefaultGroup()->getDefaultStore()->getCode();
$store = Mage::getModel('core/store')->load($code);
$url = parse_url($store->getBaseUrl());
$host = $url['host'];
$extra = '<div>' . Mage::helper('rewardpoints')->__("Serial defined for store domain '%s'", $host) . '</div>';
}
//$checkbox_name = $element->getName();
//$checkbox_name = str_replace("key", "key_validation", $checkbox_name);
$html = $extra;
//.'<input type="checkbox" name="'.$checkbox_name.'" id="revalidate" value="1" /> <label for="revalidate">'.Mage::helper('rewardpoints')->__('First time validation / Re-validate').'</label>';
return parent::_getElementHtml($element) . $html;
}
示例6: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$output = parent::_getElementHtml($element);
$output .= '<span id="themeoptions_font_view" style="font-size:28px;line-height: 28px; display:block; padding:6px 0 0 0">Preview Font</span>
<script type="text/javascript" src="' . $this->getJsUrl('magentothem/option/jquery-1.6.2.min.js') . '"></script>
<script type="text/javascript">
jQuery.noConflict();
jQuery(function(){
fontSelect=jQuery("#themeoptions_themeoptions_config_font");
fontUpdate=function(){
curFont=jQuery("#themeoptions_themeoptions_config_font").val();
curFont_text=curFont.replace(/\\+/g, " ");
jQuery("#themeoptions_font_view").css({ fontFamily: curFont_text });
jQuery("<link />",{href:"http://fonts.googleapis.com/css?family="+curFont,rel:"stylesheet",type:"text/css"}).appendTo("head");
}
fontSelect.change(function(){
fontUpdate();
}).keyup(function(){
fontUpdate();
}).keydown(function(){
fontUpdate();
});
jQuery("#themeoptions_themeoptions_config_font").trigger("change");
})
</script>
';
return $output;
}
示例7: _getElementHtml
/**
* Override for disabling support information until API token is set
*
* @param Varien_Data_Form_Element_Abstract $element
*
* @return string
*/
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
if (!Mage::helper('bronto_verify/apitoken')->getStatus()) {
$element->setDisabled('disabled');
}
return parent::_getElementHtml($element);
}
示例8: _getElementHtml
/**
* Ajax Create the datafields.
*
* @param Varien_Data_Form_Element_Abstract $element
*
* @return string
*/
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$url = Mage::helper('adminhtml')->getUrl('*/connector/createnewdatafield');
$website = Mage::app()->getRequest()->getParam('website', 0);
$element->setData('after_element_html', "<script>\n function createDatafield(form, element) {\n var datafield_name \t= \$('connector_data_mapping_dynamic_datafield_datafield_name').value;\n var datafield_type \t= \$('connector_data_mapping_dynamic_datafield_datafield_type').value;\n var datafield_default \t= \$('connector_data_mapping_dynamic_datafield_datafield_default').value;\n var datafield_access = \$('connector_data_mapping_dynamic_datafield_datafield_access').value;\n\n var reloadurl = '{$url}';\n\n if(datafield_name && datafield_type && datafield_access){\n new Ajax.Request(reloadurl, {\n method: 'post',\n parameters: {'name' : datafield_name, 'type' : datafield_type, 'default' : datafield_default, 'access' : datafield_access, 'website': '{$website}'},\n onComplete: function(transport) {\n window.location.reload();\n }\n });\n }\n return false;}</script>");
return parent::_getElementHtml($element);
}
示例9: _getElementHtml
/**
* Override method to output our custom HTML with JavaScript
*
* @param Varien_Data_Form_Element_Abstract $element
*
* @return String
*/
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
// Only do validation if module is installed and active
if ($this->helper('bronto_common')->isModuleInstalled('Bronto_Verify')) {
$_html = array();
// Create form object to grab scope details
$form = new Mage_Adminhtml_Block_System_Config_Form();
$scope = $form->getScope();
$scopeId = $form->getScopeId();
$element->setData('onchange', "validateToken(this.form, this);");
$element->setData('after_element_html', "\n <span id=\"loadingMask\" style=\"display: none; width: 100px;\">\n <span class=\"loader\" id=\"loading-mask-loader\" style=\"background: url(" . $this->getSkinUrl('bronto/images/ajax-loader-tr.gif') . ") no-repeat 0 50%; background-size: 20px; padding:3px 0 3px 25px;\">" . $this->__(' Verifying...') . "</span>\n <span id=\"loading-mask\"></span>\n </span>\n <script>\n /**\n * Function to Toggle Form Elements Disabled Status Based On Token Status\n */\n function toggleDisabled(form, element) {\n // Get Status Text Element\n var statusText = \$('bronto-validation-status-text');\n // If Status Text Element has Class of 'invalid' or empty, set boolean disabled value\n var disabled = (statusText.className == 'invalid' || statusText.className == '');\n\n // Cycle through form elements and disable/enable elements\n for (i = 0; i < form.length; i++) {\n if (form.elements[i].id != '{$element->getId()}' &&\n form.elements[i].id != 'bronto_settings_enabled' &&\n form.elements[i].id != 'verify-button' &&\n form.elements[i].type != 'hidden' &&\n form.elements[i].name.indexOf('groups') == 0) {\n form.elements[i].disabled = disabled;\n }\n }\n\n // Get Last Element of Form, and if the class name is 'note', empty the html value\n var last = element.parentNode.lastChild;\n if (last.className == 'note') {\n last.innerHTML = '';\n }\n }\n\n function trim1 (str) {\n return str.replace(/^\\s\\s*/, '').replace(/\\s\\s*\$/, '');\n }\n\n function validateToken(form, element) {\n var token = trim1(\$('{$element->getId()}').value);\n var statusText = \$('bronto-validation-status');\n var reloadUrl = '{$this->getUrl('*/apitoken/ajaxvalidation')}';\n\n statusText.innerHTML = \$('loadingMask').innerHTML;\n statusText.removeClassName('valid').removeClassName('invalid');\n\n new Ajax.Request(reloadUrl, {\n method: 'post',\n parameters: {token: token, scope: '{$scope}', scopeid: '{$scopeId}'},\n onComplete: function(transport) {\n Element.hide('loadingMask');\n statusText.innerHTML = transport.responseText;\n\n toggleDisabled(form, element);\n }\n });\n\n return false;\n }\n </script>\n ");
if (!$this->helper('bronto_common')->getApiToken()) {
$element->setComment('<span style="color:red;font-weight:bold">Please enter your Bronto API key here.</span>');
$buttonHtml = "";
} else {
$button = $this->getLayout()->createBlock('bronto_verify/adminhtml_widget_button_runtoken')->toHtml();
$buttonHtml = "<p class=\"form-buttons\" id=\"verify-button\">{$button}</p>";
}
// Show Roundtrip Install Verification Status
$_html[] = $buttonHtml . '<style>' . ' #bronto-validation-status { color:grey; font-weight:bold; }' . ' #bronto-validation-status .valid { color: green; }' . ' #bronto-validation-status .invalid { color: red; }' . '</style>' . '<strong style="float: left; width: 80px">Last Status:</strong> ' . '<span id="bronto-validation-status">' . $this->helper('bronto_verify/apitoken')->getAdminScopedApitokenStatusText() . '</span>';
// Show everything Else
if (!empty($_html)) {
$elementHtml = $element->getElementHtml();
if ($element->getComment()) {
$elementHtml .= '<p class="note"><span>' . $element->getComment() . '</span></p>';
$element->setComment(null);
}
$elementHtml .= '<div style="margin-top:10px">';
$elementHtml .= implode('<br />', $_html);
$elementHtml .= '</div>';
return $elementHtml;
}
}
return parent::_getElementHtml($element);
}
示例10: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$html = parent::_getElementHtml($element);
$imgParth = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB) . 'media/wysiwyg/magenthemes/mtghost/product/layout/';
$js = $this->getJsUrl('magenthemes/jquery/jquery.min.js');
$html .= '
<script type="text/javascript" src="' . $js . '"></script>
<script type="text/javascript">jQuery.noConflict();</script>
';
$html .= '<br/><div id="layout_' . $element->getHtmlId() . '" class="layout_preview" style="min-height: 210px;"></div>';
$html .= '
<script type="text/javascript">
jQuery(window).load(function(){
var layout = jQuery("#' . $element->getHtmlId() . ' option:selected").val();
jQuery("#' . $element->getHtmlId() . '")
.change(function() {
var imageLayout = "";
jQuery( "#' . $element->getHtmlId() . ' option:selected" ).each(function() {
imageLayout += "' . $imgParth . '"+jQuery( this ).val()+".png";
});
jQuery("#layout_' . $element->getHtmlId() . '").html("<img src="+imageLayout+" />");
}).trigger("change");
});
</script>';
return $html;
}
示例11: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
if (!Mage::helper('Mage_Catalog_Helper_Category_Flat')->isRebuilt()) {
$element->setDisabled('disabled')->setValue(0);
}
return parent::_getElementHtml($element);
}
示例12: _getElementHtml
/**
* Override method to output our custom HTML with JavaScript
*
* @param Varien_Data_Form_Element_Abstract $element
*
* @return String
*/
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
if (!extension_loaded('soap') || !extension_loaded('openssl')) {
$element->setDisabled('disabled')->setValue(0);
} else {
// Get Config Link
$configLink = Mage::helper('bronto_common')->getScopeUrl('/system_config/edit/section/bronto');
if (!Mage::helper('bronto_verify/apitoken')->getStatus()) {
if (trim($element->getLabel()) === 'Enable Module') {
$element->setDisabled('disabled')->setValue(0);
$link = '<a href="' . $configLink . '">Fix it Here</a>';
$element->setComment('<span style="color:red;font-weight: bold">A valid Bronto API key is required. ' . $link . '</span>');
}
} else {
if (!Mage::helper('bronto_common')->isEnabled()) {
if (trim($element->getLabel()) === 'Enable Module') {
$element->setDisabled('disabled')->setValue(0);
$link = '<a href="' . $configLink . '">Enable It Here</a>';
$element->setComment('<span style="color:red;font-weight: bold">The Bronto Extension for Magento is not enabled. ' . $link . '</span>');
}
} else {
if (!Mage::helper('bronto_common/support')->isRegistered()) {
if (trim($element->getLabel()) !== 'Enable Module' || !$element->getValue()) {
$link = '<a href="' . $configLink . '#bronto_support-head">Register Here</a>';
$element->setDisabled('disabled');
$element->setComment('<span style="color:red;font-weight:bold">Extension registration is required. ' . $link . '</span>');
}
}
}
}
}
return parent::_getElementHtml($element);
}
示例13: _getElementHtml
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$html = parent::_getElementHtml($element);
$html .= '<br/><div id="font_' . $element->getHtmlId() . '" class="font_preview" style="font-size: 13px; padding: 10px; 0">The quick brown fox jumps over the lazy dog</div>';
$html .= '
<script type="text/javascript">
jQuery(document).ready(function(){
var font = jQuery("#' . $element->getHtmlId() . '").val();
changeFont' . $element->getHtmlId() . '(font);
jQuery("#' . $element->getHtmlId() . '").bind("change", function() {
value = jQuery("#' . $element->getHtmlId() . '").val();
changeFont' . $element->getHtmlId() . '(value);
});
function changeFont' . $element->getHtmlId() . '(val){
var link = jQuery("<link>", {
type: "text/css",
rel: "stylesheet",
href: "//fonts.googleapis.com/css?family=" + val,
}).appendTo("head");
jQuery("#font_' . $element->getHtmlId() . '").css("font-family", val);
}
});
</script>
';
return $html;
}
示例14: _getElementHtml
/**
* Override field method to add js
*
* @param Varien_Data_Form_Element_Abstract $element
* @return String
*/
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
// Get the default HTML for this option
$html = parent::_getElementHtml($element);
if (!Mage::registry('mColorPicker')) {
$html .= '
<script type="text/javascript">
jQuery.fn.mColorPicker.init.replace = false;
jQuery.fn.mColorPicker.init.enhancedSwatches = false;
jQuery.fn.mColorPicker.init.allowTransparency = true;
jQuery.fn.mColorPicker.init.showLogo = false;
jQuery.fn.mColorPicker.defaults.imageFolder = "' . $this->getJsUrl('shopshark/mColorPicker/') . '";
</script>
';
Mage::register('mColorPicker', 1);
}
$html .= '
<script type="text/javascript">
jQuery(function($){
$("#' . $element->getHtmlId() . '").width("200px").attr("data-hex", true).mColorPicker();
});
</script>
';
return $html;
}
示例15: _getElementHtml
/**
* Render Default Product Price field as disabled if user does not have enough permissions
*
* @param Varien_Data_Form_Element_Abstract $element
* @return string
*/
protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
if (!Mage::helper('enterprise_pricepermissions')->getCanAdminEditProductPrice()) {
$element->setReadonly(true, true);
}
return parent::_getElementHtml($element);
}