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


PHP AbstractElement::getValue方法代碼示例

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


在下文中一共展示了AbstractElement::getValue方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: _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

示例5: _getElementHtml

 /**
  * @param AbstractElement $element
  * @return string
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 protected function _getElementHtml(AbstractElement $element)
 {
     $_months = [];
     for ($i = 1; $i <= 12; $i++) {
         $_months[$i] = $this->_localeDate->date(mktime(null, null, null, $i))->format('m');
     }
     $_days = [];
     for ($i = 1; $i <= 31; $i++) {
         $_days[$i] = $i < 10 ? '0' . $i : $i;
     }
     if ($element->getValue()) {
         $values = explode(',', $element->getValue());
     } else {
         $values = [];
     }
     $element->setName($element->getName() . '[]');
     $_monthsHtml = $element->setStyle('width:100px;')->setValues($_months)->setValue(isset($values[0]) ? $values[0] : null)->getElementHtml();
     $_daysHtml = $element->setStyle('width:50px;')->setValues($_days)->setValue(isset($values[1]) ? $values[1] : null)->getElementHtml();
     return sprintf('%s %s', $_monthsHtml, $_daysHtml);
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:25,代碼來源:YtdStart.php

示例6: getInputHtml

 /**
  * Render HTML of the element using the rule engine.
  *
  * @return string
  */
 public function getInputHtml()
 {
     $this->rule->setElementName($this->element->getName());
     if ($this->element->getValue()) {
         /* Hack : reload in a new instance to have element name set.
          *        can not be done in afterLoad of the backend model
          *        since we do not know yet the form structure
          */
         $conditions = $this->element->getValue()->getConditions()->asArray();
         $this->rule->getConditions()->loadArray($conditions);
         $this->element->setRule($this->rule);
     }
     $this->input = $this->elementFactory->create('text');
     $this->input->setRule($this->rule)->setRenderer($this->conditions);
     return $this->input->toHtml();
 }
開發者ID:smile-sa,項目名稱:elasticsuite,代碼行數:21,代碼來源:Conditions.php

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

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

示例9: _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,代碼來源:

示例10: _getElementHtml

 /**
  * @param AbstractElement $element
  * @return string
  * @codeCoverageIgnore
  */
 protected function _getElementHtml(AbstractElement $element)
 {
     return $this->dateTimeFormatter->formatObject($this->_localeDate->date(intval($element->getValue())), $this->_localeDate->getDateTimeFormat(\IntlDateFormatter::MEDIUM));
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:9,代碼來源:Datetime.php

示例11: _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::getValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。