当前位置: 首页>>代码示例>>PHP>>正文


PHP AbstractElement::getElementHtml方法代码示例

本文整理汇总了PHP中Magento\Framework\Data\Form\Element\AbstractElement::getElementHtml方法的典型用法代码示例。如果您正苦于以下问题:PHP AbstractElement::getElementHtml方法的具体用法?PHP AbstractElement::getElementHtml怎么用?PHP AbstractElement::getElementHtml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\Data\Form\Element\AbstractElement的用法示例。


在下文中一共展示了AbstractElement::getElementHtml方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _getElementHtml

 protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     $element->setValue(0);
     $element->setDisabled('disabled');
     $element->setValues([['label' => __('Disabled - Coming Soon...'), 'value' => '0']]);
     return $element->getElementHtml();
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:7,代码来源:Field.php

示例2: render

 /**
  * Output the region element and javasctipt that makes it dependent from country element
  *
  * @param \Magento\Framework\Data\Form\Element\AbstractElement $element
  * @return string
  *
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     if ($country = $element->getForm()->getElement('country_id')) {
         $countryId = $country->getValue();
     } else {
         return $element->getDefaultHtml();
     }
     $regionId = $element->getForm()->getElement('region_id')->getValue();
     $html = '<div class="field field-state required">';
     $element->setClass('input-text');
     $element->setRequired(true);
     $html .= $element->getLabelHtml() . '<div class="control">';
     $html .= $element->getElementHtml();
     $selectName = str_replace('region', 'region_id', $element->getName());
     $selectId = $element->getHtmlId() . '_id';
     $html .= '<select id="' . $selectId . '" name="' . $selectName . '" class="select required-entry" style="display:none">';
     $html .= '<option value="">' . __('Please select') . '</option>';
     $html .= '</select>';
     $html .= '<script>' . "\n";
     $html .= 'require(["prototype", "mage/adminhtml/form"], function(){';
     $html .= '$("' . $selectId . '").setAttribute("defaultValue", "' . $regionId . '");' . "\n";
     $html .= 'new regionUpdater("' . $country->getHtmlId() . '", "' . $element->getHtmlId() . '", "' . $selectId . '", ' . $this->_directoryHelper->getRegionJson() . ');' . "\n";
     $html .= '});';
     $html .= '</script>' . "\n";
     $html .= '</div></div>' . "\n";
     return $html;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:35,代码来源:Region.php

示例3: getElementHtml

 /**
  * @return string
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 public function getElementHtml()
 {
     if ($checked = $this->getChecked()) {
         $this->setData('checked', true);
     } else {
         $this->unsetData('checked');
     }
     return parent::getElementHtml();
 }
开发者ID:IlyaGluschenko,项目名称:test001,代码行数:13,代码来源:Checkbox.php

示例4: render

 /**
  * @param AbstractElement $element
  * @return string
  */
 public function render(AbstractElement $element)
 {
     $element->addClass('element-value-changer');
     $html = '&nbsp;<span class="rule-param rule-param-new-child"' . ($element->getParamId() ? ' id="' . $element->getParamId() . '"' : '') . '>';
     $html .= '<a href="javascript:void(0)" class="label">';
     $html .= $element->getValueName();
     $html .= '</a><span class="element">';
     $html .= $element->getElementHtml();
     $html .= '</span></span>&nbsp;';
     return $html;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:15,代码来源:Newchild.php

示例5: getElementHtml

 /**
  * Return element html code
  *
  * @return string
  */
 public function getElementHtml()
 {
     $html = '';
     if ((string) $this->getValue()) {
         $url = $this->_getUrl();
         if (!preg_match("/^http\\:\\/\\/|https\\:\\/\\//", $url)) {
             $url = $this->_urlBuilder->getBaseUrl(['_type' => UrlInterface::URL_TYPE_MEDIA]) . $url;
         }
         $html = '<a href="' . $url . '"' . ' onclick="imagePreview(\'' . $this->getHtmlId() . '_image\'); return false;" ' . $this->_getUiId('link') . '>' . '<img src="' . $url . '" id="' . $this->getHtmlId() . '_image" title="' . $this->getValue() . '"' . ' alt="' . $this->getValue() . '" height="22" width="22" class="small-image-preview v-middle"  ' . $this->_getUiId() . ' />' . '</a> ';
     }
     $this->setClass('input-file');
     $html .= parent::getElementHtml();
     $html .= $this->_getDeleteCheckbox();
     return $html;
 }
开发者ID:IlyaGluschenko,项目名称:test001,代码行数:20,代码来源:Image.php

示例6: render

 /**
  * @param AbstractElement $element
  * @return string
  */
 public function render(AbstractElement $element)
 {
     $html = '<div class="field field-' . $element->getHtmlId() . '">';
     $html .= $element->getLabelHtml();
     $html .= '<div class="control">' . $element->getElementHtml();
     $html .= '<div class="nested">';
     $html .= '<div class="field choice">';
     $html .= '<label for="account-send-pass" class="addbefore"><span>' . __('or ') . '</span></label>';
     $html .= '<input type="checkbox" id="account-send-pass" name="' . $element->getName() . '" value="auto" onclick="setElementDisable(\'' . $element->getHtmlId() . '\', this.checked)" />';
     $html .= '<label class="label" for="account-send-pass"><span>' . __(' Send auto-generated password') . '</span></label>';
     $html .= '</div>' . "\n";
     $html .= '</div>' . "\n";
     $html .= '</div>' . "\n";
     $html .= '</div>' . "\n";
     return $html;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:20,代码来源:Newpass.php

示例7: getElementHtml

    /**
     * Enter description here...
     *
     * @return string
     */
    public function getElementHtml()
    {
        $html = '';
        $html .= '<input id="time_condition" type="hidden" name="' . $this->getName() . '" value="' . time() . '" />';
        $html .= <<<EndHTML
        <script type="text/javascript">
        Event.observe(\$('carriers_tablerate_condition_name'), 'change', checkConditionName.bind(this));
        function checkConditionName(event)
        {
            var conditionNameElement = Event.element(event);
            if (conditionNameElement && conditionNameElement.id) {
                \$('time_condition').value = '_' + conditionNameElement.value + '/' + Math.random();
            }
        }
        </script>
EndHTML;
        $html .= parent::getElementHtml();
        return $html;
    }
开发者ID:aiesh,项目名称:magento2,代码行数:24,代码来源:Import.php

示例8: getElementHtml

 public function getElementHtml(AbstractElement $element)
 {
     $classes = ["tinify-connection-status"];
     switch ($this->status->getStatus()) {
         case ConnectionStatus::UNKNOWN:
             $element->setValue(__("Save configuration to check status."));
             break;
         case ConnectionStatus::SUCCESS:
             $classes[] = "tinify-success";
             $element->setValue(__("API connection successful."));
             $element->setComment(__("You have made %1 compressions this month.", $this->status->getCompressionCount()));
             break;
         case ConnectionStatus::FAILURE:
             $classes[] = "tinify-failure";
             $element->setValue(__("API connection unsuccessful."));
             $element->setComment(__("Error: %1", $this->status->getLastError()));
             break;
     }
     return "<div class=\"" . implode(" ", $classes) . "\">{$element->getElementHtml()}</div>";
 }
开发者ID:tinify,项目名称:magento2-plugin,代码行数:20,代码来源:ConnectionStatusField.php

示例9: _getElementHtml

 /**
  * @param \Magento\Framework\Data\Form\Element\AbstractElement $element
  * @return string
  */
 protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     $html = $element->getElementHtml();
     $value = $element->getData('value');
     $html .= '<script type="text/javascript">
         require(["jquery","jquery/colorpicker/js/colorpicker"], function ($) {
             $(document).ready(function () {
                 var $el = $("#' . $element->getHtmlId() . '");
                 $el.css("backgroundColor", "' . $value . '");
                 // Attach the color picker
                 $el.ColorPicker({
                     color: "' . $value . '",
                     onChange: function (hsb, hex, rgb) {
                         $el.css("backgroundColor", "#" + hex).val("#" + hex);
                     }
                 });
             });
         });
         </script>';
     return $html;
 }
开发者ID:clkweb,项目名称:popup,代码行数:25,代码来源:Color.php

示例10: render

 /**
  * Render element
  *
  * @param \Magento\Framework\Data\Form\Element\AbstractElement $element
  * @return string
  *
  * @see RendererInterface::render()
  */
 public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     $element->addClass('element-value-changer');
     $valueName = $element->getValueName();
     if ($valueName === '') {
         $valueName = '...';
     }
     if ($element->getShowAsText()) {
         $html = ' <input type="hidden" class="hidden" id="' . $element->getHtmlId() . '" name="' . $element->getName() . '" value="' . $element->getValue() . '"/> ' . htmlspecialchars($valueName) . '&nbsp;';
     } else {
         $html = ' <span class="rule-param"' . ($element->getParamId() ? ' id="' . $element->getParamId() . '"' : '') . '>' . '<a href="javascript:void(0)" class="label">';
         if ($this->inlineTranslate->isAllowed()) {
             $html .= $this->escapeHtml($valueName);
         } else {
             $html .= $this->escapeHtml($this->filterManager->truncate($valueName, ['length' => 33, 'etc' => '...']));
         }
         $html .= '</a><span class="element"> ' . $element->getElementHtml();
         if ($element->getExplicitApply()) {
             $html .= ' <a href="javascript:void(0)" class="rule-param-apply"><img src="' . $this->getViewFileUrl('images/rule_component_apply.gif') . '" class="v-middle" alt="' . __('Apply') . '" title="' . __('Apply') . '" /></a> ';
         }
         $html .= '</span></span>&nbsp;';
     }
     return $html;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:32,代码来源:Editable.php

示例11: testGetElementHtml

 /**
  * @param array $initialData
  * @param string $expectedValue
  * @dataProvider getElementHtmlDataProvider
  * @covers \Magento\Framework\Data\Form\Element\AbstractElement::getElementHtml()
  */
 public function testGetElementHtml(array $initialData, $expectedValue)
 {
     $this->_model->setForm($this->getMock('Magento\\Framework\\Data\\Form\\AbstractForm', [], [], '', false));
     $this->_model->setData($initialData);
     $this->assertEquals($expectedValue, $this->_model->getElementHtml());
 }
开发者ID:,项目名称:,代码行数:12,代码来源:

示例12: _getElementHtml

 /**
  * Retrieve element HTML markup
  *
  * @param \Magento\Framework\Data\Form\Element\AbstractElement $element
  * @return string
  */
 protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     return $element->getElementHtml();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:10,代码来源:Field.php


注:本文中的Magento\Framework\Data\Form\Element\AbstractElement::getElementHtml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。