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


PHP AbstractElement::setValue方法代码示例

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


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

示例1: _getElementHtml

 /**
  * @param AbstractElement $element
  * @return string
  */
 protected function _getElementHtml(AbstractElement $element)
 {
     $element->setStyle('width:70px;')->setName($element->getName() . '[]');
     if ($element->getValue()) {
         $values = explode(',', $element->getValue());
     } else {
         $values = [];
     }
     $from = $element->setValue(isset($values[0]) ? $values[0] : null)->getElementHtml();
     $to = $element->setValue(isset($values[1]) ? $values[1] : null)->getElementHtml();
     return __('<label class="label"><span>from</span></label>') . $from . __('<label class="label"><span>to</span></label>') . $to;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:16,代码来源:YearRange.php

示例2: _getElementHtml

 /**
  * @param AbstractElement $element
  * @return string
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 protected function _getElementHtml(AbstractElement $element)
 {
     $_options = ['d' => __('Day'), 'm' => __('Month'), 'y' => __('Year')];
     $element->setValues($_options)->setClass('select-date')->setName($element->getName() . '[]');
     if ($element->getValue()) {
         $values = explode(',', $element->getValue());
     } else {
         $values = [];
     }
     $_parts = [];
     $_parts[] = $element->setValue(isset($values[0]) ? $values[0] : null)->getElementHtml();
     $_parts[] = $element->setValue(isset($values[1]) ? $values[1] : null)->getElementHtml();
     $_parts[] = $element->setValue(isset($values[2]) ? $values[2] : null)->getElementHtml();
     return implode(' <span>/</span> ', $_parts);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:20,代码来源:DateFieldsOrder.php

示例3: _getElementHtml

 /**
  * @param AbstractElement $element
  * @return string
  */
 protected function _getElementHtml(AbstractElement $element)
 {
     $extensionVersion = $this->_helper->getExtensionVersion();
     $versionLabel = sprintf('<a href="%s" title="Easy Template Path Hints for Magento 2" target="_blank">%s</a>', self::EXTENSION_URL, $extensionVersion);
     $element->setValue($versionLabel);
     return $element->getValue();
 }
开发者ID:EliasKotlyar,项目名称:magento2-easy-template-path-hints,代码行数:11,代码来源:Version.php

示例4: render

    public function render(AbstractElement $element)
    {
        $element->unsScope();
        $element->unsCanUseWebsiteValue();
        $element->unsCanUseDefaultValue();
        $element->setValue(__('Update'));
        $element->setData('onclick', 'javascript:geoIpUpdate(); return false;');
        $element->setData('class', 'action-default');
        $element->setData('after_element_js', '<script type="application/javascript">
    require(["jquery"], function($){
        window.geoIpUpdate = function() {
            $.getJSON(
                "' . $this->getUrl('tobai_geoip2/database/update') . '",
                function(data) {
                    if (data.status_info) {
                        $("#row_tobai_geoip2_database_status .value").html(data.status_info);
                    }
                }
            );
        };

        $(document).bind("ajaxSend", function() {
            $("body").trigger("processStart");
        });

        $(document).bind("ajaxComplete", function() {
            $("body").trigger("processStop");
        });
    });
</script>');
        return parent::render($element);
    }
开发者ID:ytorbyk,项目名称:magento2-geo-ip2,代码行数:32,代码来源:Update.php

示例5: _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

示例6: render

 /**
  * Render given element (return html of element)
  *
  * @param \Magento\Framework\Data\Form\Element\AbstractElement $element The element
  *
  * @return string
  */
 public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     if ($this->getValues()) {
         $element->setValue($this->getValues());
     }
     $this->setElement($element);
     return $this->toHtml();
 }
开发者ID:smile-sa,项目名称:elasticsuite,代码行数:15,代码来源:AbstractRenderer.php

示例7: _getElementHtml

 /**
  * @param AbstractElement $element
  * @return string
  */
 protected function _getElementHtml(AbstractElement $element)
 {
     $extensionVersion = $this->_helper->getExtensionVersion();
     $extensionTitle = 'Custom Shipping';
     $versionLabel = sprintf('<a href="%s" title="%s" target="_blank">%s</a>', self::EXTENSION_URL, $extensionTitle, $extensionVersion);
     $element->setValue($versionLabel);
     return $element->getValue();
 }
开发者ID:MagePsycho,项目名称:magento2-custom-shipping,代码行数:12,代码来源:Version.php

示例8: testGetEscapedValueWithFilter

 /**
  * @covers \Magento\Framework\Data\Form\Element\AbstractElement::getEscapedValue()
  */
 public function testGetEscapedValueWithFilter()
 {
     $value = '<a href="#hash_tag">my \'quoted\' string</a>';
     $expectedValue = '&lt;a href=&quot;#hash_tag&quot;&gt;my \'quoted\' string&lt;/a&gt;';
     $filterMock = $this->getMock('Magento\\Framework\\Object', ['filter'], [], '', false);
     $filterMock->expects($this->once())->method('filter')->with($value)->will($this->returnArgument(0));
     $this->_model->setValueFilter($filterMock);
     $this->_model->setValue($value);
     $this->assertEquals($expectedValue, $this->_model->getEscapedValue());
 }
开发者ID:,项目名称:,代码行数:13,代码来源:

示例9: 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

示例10: render

 /**
  * Render country field considering request parameter
  *
  * @param \Magento\Framework\Data\Form\Element\AbstractElement $element
  * @return string
  */
 public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     $country = $this->getRequest()->getParam(StructurePlugin::REQUEST_PARAM_COUNTRY);
     if ($country) {
         $element->setValue($country);
     }
     if ($element->getCanUseDefaultValue()) {
         $this->_defaultCountry = $this->_scopeConfig->getValue(self::FIELD_CONFIG_PATH);
         if (!$this->_defaultCountry) {
             $this->_defaultCountry = $this->directoryHelper->getDefaultCountry();
         }
         if ($country) {
             $shouldInherit = $country == $this->_defaultCountry && $this->getRequest()->getParam(self::REQUEST_PARAM_DEFAULT_COUNTRY);
             $element->setInherit($shouldInherit);
         }
         if ($element->getInherit()) {
             $this->_defaultCountry = null;
         }
     }
     return parent::render($element);
 }
开发者ID:IlyaGluschenko,项目名称:protection,代码行数:27,代码来源:Country.php

示例11: _getElementHtml

 /**
  * @param AbstractElement $element
  * @return string
  */
 protected function _getElementHtml(AbstractElement $element)
 {
     $element->setValue($this->_cache->load('admin_notifications_lastcheck'));
     $format = $this->_localeDate->getDateTimeFormat(\IntlDateFormatter::MEDIUM);
     return $this->dateTimeFormatter->formatObject($this->_localeDate->date(intval($element->getValue())), $format);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:10,代码来源:Notification.php

示例12: _getElementHtml

 /**
  * @param AbstractElement $element
  * @return string
  */
 protected function _getElementHtml(AbstractElement $element)
 {
     $element->setValue($this->_cache->load('admin_notifications_lastcheck'));
     $format = $this->_localeDate->getDateTimeFormat(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::FORMAT_TYPE_MEDIUM);
     return $this->_localeDate->date(intval($element->getValue()))->toString($format);
 }
开发者ID:,项目名称:,代码行数:10,代码来源:

示例13: _getElementHtml

 protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     $element->setValue($this->_cache->load(\Dotdigitalgroup\Email\Helper\Config::CONNECTOR_FEED_LAST_CHECK_TIME));
     $format = $this->_localeDate->getDateTimeFormat(\IntlDateFormatter::MEDIUM);
     return $this->dateTimeFormatter->formatObject($this->_localeDate->date(intval($element->getValue())), $format);
 }
开发者ID:dragonsword007008,项目名称:magento2,代码行数:6,代码来源:Notification.php


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