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


PHP Template::_toHtml方法代碼示例

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


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

示例1: _toHtml

 /**
  * @return string
  */
 protected function _toHtml()
 {
     $cssClasses = $this->hasData('css_classes') ? explode(' ', $this->getData('css_classes')) : [];
     $cssClasses[] = 'price-' . $this->getPrice()->getPriceCode();
     $this->setData('css_classes', implode(' ', $cssClasses));
     return parent::_toHtml();
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:10,代碼來源:PriceBox.php

示例2: _toHtml

 /**
  * {@inheritdoc}
  */
 protected function _toHtml()
 {
     if (!$this->getProductTypes()) {
         return '';
     }
     return parent::_toHtml();
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:10,代碼來源:AddToWishlist.php

示例3: _toHtml

 /**
  * @return string
  */
 protected function _toHtml()
 {
     if ($this->getOrders()->getSize() > 0) {
         return parent::_toHtml();
     }
     return '';
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:10,代碼來源:Recent.php

示例4: _toHtml

 /**
  * @inheritdoc
  */
 protected function _toHtml()
 {
     if (!$this->isInContext()) {
         return '';
     }
     return parent::_toHtml();
 }
開發者ID:BlackIkeEagle,項目名稱:magento2-continuousphp,代碼行數:10,代碼來源:Component.php

示例5: _toHtml

 /**
  * Render tag manager script
  *
  * @return string
  */
 protected function _toHtml()
 {
     if ($this->_cookieHelper->isUserNotAllowSaveCookie() || !$this->_gtmHelper->isEnabled()) {
         return '';
     }
     return parent::_toHtml();
 }
開發者ID:samynw,項目名稱:magento2-google-tagmanager,代碼行數:12,代碼來源:Gtm.php

示例6: _toHtml

 /**
  * @inheritdoc
  */
 protected function _toHtml()
 {
     if ($this->isActive()) {
         return parent::_toHtml();
     }
     return '';
 }
開發者ID:BlackIkeEagle,項目名稱:magento2-continuousphp,代碼行數:10,代碼來源:Button.php

示例7: _toHtml

 /**
  * Render block HTML
  *
  * @return string
  */
 protected function _toHtml()
 {
     if (false != $this->getTemplate()) {
         return parent::_toHtml();
     }
     $highlight = '';
     if ($this->getIsHighlighted()) {
         $highlight = ' current';
     }
     if ($this->isCurrent()) {
         $html = '<li class="nav item current">';
         $html .= '<strong>' . $this->escapeHtml((string) new \Magento\Framework\Phrase($this->getLabel())) . '</strong>';
         $html .= '</li>';
     } else {
         $html = '<li class="nav item' . $highlight . '"><a href="' . $this->escapeHtml($this->getHref()) . '"';
         $html .= $this->getTitle() ? ' title="' . $this->escapeHtml((string) new \Magento\Framework\Phrase($this->getTitle())) . '"' : '';
         $html .= $this->getAttributesHtml() . '>';
         if ($this->getIsHighlighted()) {
             $html .= '<strong>';
         }
         $html .= $this->escapeHtml((string) new \Magento\Framework\Phrase($this->getLabel()));
         if ($this->getIsHighlighted()) {
             $html .= '</strong>';
         }
         $html .= '</a></li>';
     }
     return $html;
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:33,代碼來源:Current.php

示例8: _toHtml

 /**
  * Render block HTML
  *
  * @return string
  */
 protected function _toHtml()
 {
     if (false != $this->getTemplate()) {
         return parent::_toHtml();
     }
     return '<li><a ' . $this->getLinkAttributes() . ' >' . $this->escapeHtml($this->getLabel()) . '</a></li>';
 }
開發者ID:Atlis,項目名稱:docker-magento2,代碼行數:12,代碼來源:Link.php

示例9: _toHtml

 /**
  * Render block HTML
  *
  * @return string
  */
 protected function _toHtml()
 {
     $localeData = (new DataBundle())->get($this->_localeResolver->getLocale());
     // get days names
     $daysData = $localeData['calendar']['gregorian']['dayNames'];
     $this->assign('days', ['wide' => $this->encoder->encode(array_values(iterator_to_array($daysData['format']['wide']))), 'abbreviated' => $this->encoder->encode(array_values(iterator_to_array($daysData['format']['abbreviated'])))]);
     // get months names
     $monthsData = $localeData['calendar']['gregorian']['monthNames'];
     $this->assign('months', ['wide' => $this->encoder->encode(array_values(iterator_to_array($monthsData['format']['wide']))), 'abbreviated' => $this->encoder->encode(array_values(iterator_to_array($monthsData['format']['abbreviated'])))]);
     // get "today" and "week" words
     $this->assign('today', $this->encoder->encode($localeData['fields']['day']['relative']['0']));
     $this->assign('week', $this->encoder->encode($localeData['fields']['week']['dn']));
     // get "am" & "pm" words
     $this->assign('am', $this->encoder->encode($localeData['calendar']['gregorian']['AmPmMarkers']['0']));
     $this->assign('pm', $this->encoder->encode($localeData['calendar']['gregorian']['AmPmMarkers']['1']));
     // get first day of week and weekend days
     $this->assign('firstDay', (int) $this->_scopeConfig->getValue('general/locale/firstday', \Magento\Store\Model\ScopeInterface::SCOPE_STORE));
     $this->assign('weekendDays', $this->encoder->encode((string) $this->_scopeConfig->getValue('general/locale/weekend', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)));
     // define default format and tooltip format
     $this->assign('defaultFormat', $this->encoder->encode($this->_localeDate->getDateFormat(\IntlDateFormatter::MEDIUM)));
     $this->assign('toolTipFormat', $this->encoder->encode($this->_localeDate->getDateFormat(\IntlDateFormatter::LONG)));
     // get days and months for en_US locale - calendar will parse exactly in this locale
     $englishMonths = (new DataBundle())->get('en_US')['calendar']['gregorian']['monthNames'];
     $enUS = new \stdClass();
     $enUS->m = new \stdClass();
     $enUS->m->wide = array_values(iterator_to_array($englishMonths['format']['wide']));
     $enUS->m->abbr = array_values(iterator_to_array($englishMonths['format']['abbreviated']));
     $this->assign('enUS', $this->encoder->encode($enUS));
     return parent::_toHtml();
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:35,代碼來源:Calendar.php

示例10: _toHtml

 /**
  * @return string
  */
 public function _toHtml()
 {
     if (!$this->helper->isMultishippingCheckoutAvailable()) {
         return '';
     }
     return parent::_toHtml();
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:10,代碼來源:Link.php

示例11: _toHtml

 /**
  * Render tag manager JS
  *
  * @return string
  */
 protected function _toHtml()
 {
     if (!$this->_gtmHelper->isEnabled()) {
         return '';
     }
     return parent::_toHtml();
 }
開發者ID:magepal,項目名稱:magento2-googletagmanager,代碼行數:12,代碼來源:GtmCode.php

示例12: _toHtml

 /**
  * Renders captcha HTML (if required)
  *
  * @return string
  */
 protected function _toHtml()
 {
     if ($this->getCaptchaModel()->isRequired()) {
         $this->getCaptchaModel()->generate();
         return parent::_toHtml();
     }
     return '';
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:13,代碼來源:DefaultCaptcha.php

示例13: _toHtml

 /**
  * Return Boleto PDF url
  *
  * @return string
  */
 protected function _toHtml()
 {
     if ($this->isBoletoPayment()) {
         $this->addData(['boleto_pdf_url' => $this->getBoletoPdfUrl()]);
         return parent::_toHtml();
     }
     return '';
 }
開發者ID:Adyen,項目名稱:adyen-magento2,代碼行數:13,代碼來源:Success.php

示例14: _toHtml

 /**
  * Prepare form parameters and render
  *
  * @return string
  */
 protected function _toHtml()
 {
     $validator = $this->_coreRegistry->registry('current_centinel_validator');
     if ($validator && $validator->shouldAuthenticate()) {
         $this->addData($validator->getAuthenticateStartData());
         return parent::_toHtml();
     }
     return '';
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:14,代碼來源:Start.php

示例15: _toHtml

 /**
  * Prepare authentication result params and render
  *
  * @return string
  */
 protected function _toHtml()
 {
     $validator = $this->_coreRegistry->registry('current_centinel_validator');
     if ($validator) {
         $this->setIsProcessed(true);
         $this->setIsSuccess($validator->isAuthenticateSuccessful());
     }
     return parent::_toHtml();
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:14,代碼來源:Complete.php


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