本文整理匯總了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();
}
示例2: _toHtml
/**
* {@inheritdoc}
*/
protected function _toHtml()
{
if (!$this->getProductTypes()) {
return '';
}
return parent::_toHtml();
}
示例3: _toHtml
/**
* @return string
*/
protected function _toHtml()
{
if ($this->getOrders()->getSize() > 0) {
return parent::_toHtml();
}
return '';
}
示例4: _toHtml
/**
* @inheritdoc
*/
protected function _toHtml()
{
if (!$this->isInContext()) {
return '';
}
return parent::_toHtml();
}
示例5: _toHtml
/**
* Render tag manager script
*
* @return string
*/
protected function _toHtml()
{
if ($this->_cookieHelper->isUserNotAllowSaveCookie() || !$this->_gtmHelper->isEnabled()) {
return '';
}
return parent::_toHtml();
}
示例6: _toHtml
/**
* @inheritdoc
*/
protected function _toHtml()
{
if ($this->isActive()) {
return parent::_toHtml();
}
return '';
}
示例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;
}
示例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>';
}
示例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();
}
示例10: _toHtml
/**
* @return string
*/
public function _toHtml()
{
if (!$this->helper->isMultishippingCheckoutAvailable()) {
return '';
}
return parent::_toHtml();
}
示例11: _toHtml
/**
* Render tag manager JS
*
* @return string
*/
protected function _toHtml()
{
if (!$this->_gtmHelper->isEnabled()) {
return '';
}
return parent::_toHtml();
}
示例12: _toHtml
/**
* Renders captcha HTML (if required)
*
* @return string
*/
protected function _toHtml()
{
if ($this->getCaptchaModel()->isRequired()) {
$this->getCaptchaModel()->generate();
return parent::_toHtml();
}
return '';
}
示例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 '';
}
示例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 '';
}
示例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();
}