當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Field::_toHtml方法代碼示例

本文整理匯總了PHP中Magento\Config\Block\System\Config\Form\Field::_toHtml方法的典型用法代碼示例。如果您正苦於以下問題:PHP Field::_toHtml方法的具體用法?PHP Field::_toHtml怎麽用?PHP Field::_toHtml使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Config\Block\System\Config\Form\Field的用法示例。


在下文中一共展示了Field::_toHtml方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: _toHtml

 /**
  * Render block HTML
  *
  * @return string
  * @throws \Exception
  */
 protected function _toHtml()
 {
     if (!$this->_isPreparedToRender) {
         $this->_prepareToRender();
         $this->_isPreparedToRender = true;
     }
     if (empty($this->_columns)) {
         throw new \Exception('At least one column must be defined.');
     }
     return parent::_toHtml();
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:17,代碼來源:AbstractFieldArray.php

示例2: _toHtml

 public function _toHtml()
 {
     $script = "<script type=\"text/javascript\">\n                document.observe('dom:loaded', function() {\n                    \$\$('tr#row_rule_condition tr td:first-child select').each(function(item) {\n                        doUpdateWithValues(item);\n                    });\n\n                    \$\$('tr#row_rule_condition tr td:first-child select').each(function(item) {\n                        Event.observe(item,'change', function(){\n                            doUpdate(item);\n                        });\n                    });\n\n                    \$\$('tr#row_rule_condition button.add').each(function(item) {\n                         Event.observe(item,'click', function(){\n                            \$\$('tr#row_rule_condition tr td:first-child select').each(function(item) {\n                                 Event.observe(item,'change', function(){\n                                    doUpdate(item);\n                                });\n                            });\n                            \$\$('tr#row_rule_condition tr td select').each(function(item) {\n                                Event.observe(item,'change', function(){\n                                     if(item.readAttribute('title') == 'conditions'){\n                                        doUpdateForCondition(item);\n                                     }\n                                });\n                            });\n                        });\n                    });\n\n                    function doUpdate(item){\n                        var url = '" . $this->getUrl('connector/rules/ajax') . "';\n                        var cond = item.up(1).down().next();\n                        var condName = cond.down().readAttribute('name');\n                        var value = item.up(1).down().next(1);\n                        var valueName = value.down().readAttribute('name');\n                        var attribute = item.value;\n                        new Ajax.Request(url, {\n                            method: 'post',\n                            parameters: {\n                                attribute: attribute,\n                                condition: condName,\n                                value: valueName\n                            },\n                            onSuccess: function(transport){\n                                var json = transport.responseJSON;\n                                cond.update(json.condition);\n                                value.update(json.cvalue);\n\n                                \$\$('tr#row_rule_condition tr td select').each(function(item) {\n                                    Event.observe(item,'change', function(){\n                                         if(item.readAttribute('title') == 'conditions'){\n                                            doUpdateForCondition(item);\n                                         }\n                                    });\n                                });\n                            }\n                        });\n                    }\n\n                    function doUpdateWithValues(item){\n                        var url = '" . $this->getUrl('connector/rules/selected') . "';\n                        var arrayKey = item.up(1).readAttribute('id');\n                        var cond = item.up(1).down().next();\n                        var condName = cond.down().readAttribute('name');\n                        var value = item.up(1).down().next(1);\n                        var valueName = value.down().readAttribute('name');\n                        var attribute = item.value;\n                        var ruleId = \$('rule_id').value;\n                        new Ajax.Request(url, {\n                            method: 'post',\n                            parameters: {\n                                attribute: attribute,\n                                condition: condName,\n                                value: valueName,\n                                arraykey: arrayKey,\n                                ruleid: ruleId\n                            },\n                            onSuccess: function(transport){\n                                var json = transport.responseJSON;\n                                cond.update(json.condition);\n                                value.update(json.cvalue);\n\n                                \$\$('tr#row_rule_condition tr td select').each(function(item) {\n                                    Event.observe(item,'change', function(){\n                                         if(item.readAttribute('title') == 'conditions'){\n                                            doUpdateForCondition(item);\n                                         }\n                                    });\n                                });\n                            }\n                        });\n                    }\n\n                    function doUpdateForCondition(item){\n                        var url = '" . $this->getUrl('connector/rules/value') . "';\n                        var attribute = item.up(1).down();\n                        var attributeValue = attribute.down().value;\n                        var value = item.up().next();\n                        var valueName = value.down().readAttribute('name');\n                        var condValue = item.value;\n                        new Ajax.Request(url, {\n                            method: 'post',\n                            parameters: {\n                                attributeValue: attributeValue,\n                                value: valueName,\n                                condValue: condValue\n                            },\n                            onSuccess: function(transport){\n                                var json = transport.responseJSON;\n                                value.update(json.cvalue);\n                            }\n                        });\n                    }\n                });\n            </script>";
     return '<input type="hidden" id="' . $this->getElement()->getHtmlId() . '"/>' . parent::_toHtml() . $script;
 }
開發者ID:ThomasNegeli,項目名稱:dotmailer-magento2-extension,代碼行數:5,代碼來源:Customdatafields.php


注:本文中的Magento\Config\Block\System\Config\Form\Field::_toHtml方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。