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


PHP Element\Template類代碼示例

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


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

示例1: testSetTemplateContext

 public function testSetTemplateContext()
 {
     $template = 'themedir/template.phtml';
     $context = new \Magento\Framework\DataObject();
     $this->_validator->expects($this->once())->method('isValid')->with($template)->will($this->returnValue(true));
     $this->_templateEngine->expects($this->once())->method('render')->with($context);
     $this->_block->setTemplateContext($context);
     $this->_block->fetchView($template);
 }
開發者ID:whoople,項目名稱:magento2-testing,代碼行數:9,代碼來源:TemplateTest.php

示例2: afterToHtml

 /**
  * Wrap template with the debugging hints in comments
  *
  * @param Template $subject
  * @param string $result
  *
  * @return string
  */
 public function afterToHtml(Template $subject, $result)
 {
     if ($this->scopeConfig->getValue(self::XML_PATH_DEBUG_TEMPLATE_HINTS, ScopeInterface::SCOPE_STORE) && $this->appState->getMode() === State::MODE_DEVELOPER) {
         $name = $subject->getNameInLayout();
         $template = $subject->getTemplateFile();
         $class = get_class($subject);
         $result = "<!-- BEGIN {$name} using {$template} \n" . $class . '-->' . $result . "<!-- END {$name} using {$template} -->";
     }
     return $result;
 }
開發者ID:aohorodnyk,項目名稱:module-debug-comment,代碼行數:18,代碼來源:DebugHints.php

示例3: __construct

 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Framework\Registry $registry
  * @param \Magento\CatalogInventory\Api\StockStateInterface $stockState
  * @param \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Registry $registry, \Magento\CatalogInventory\Api\StockStateInterface $stockState, \Magento\CatalogInventory\Api\StockRegistryInterface $stockRegistry, array $data = [])
 {
     $this->_coreRegistry = $registry;
     $this->stockState = $stockState;
     $this->stockRegistry = $stockRegistry;
     parent::__construct($context, $data);
 }
開發者ID:pradeep-wagento,項目名稱:magento2,代碼行數:14,代碼來源:AbstractStockqty.php

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

示例5: __construct

 /**
  * Initialize dependencies
  *
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Store\Model\StoreFactory $storeFactory
  * @param \Magento\Framework\Registry $coreRegistry
  * @param \Magento\Tax\Service\V1\TaxRateServiceInterface $taxRateService
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Store\Model\StoreFactory $storeFactory, \Magento\Framework\Registry $coreRegistry, \Magento\Tax\Service\V1\TaxRateServiceInterface $taxRateService, array $data = array())
 {
     $this->_coreRegistry = $coreRegistry;
     $this->_taxRateService = $taxRateService;
     $this->_storeFactory = $storeFactory;
     parent::__construct($context, $data);
 }
開發者ID:aiesh,項目名稱:magento2,代碼行數:16,代碼來源:Title.php

示例6: __construct

 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Framework\Filter\Input\MaliciousCode $maliciousCode
  * @param PriceCurrencyInterface $priceCurrency
  * @param \Magento\Catalog\Helper\Image $imageHelper
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Filter\Input\MaliciousCode $maliciousCode, PriceCurrencyInterface $priceCurrency, \Magento\Catalog\Helper\Image $imageHelper, array $data = [])
 {
     $this->imageHelper = $imageHelper;
     $this->priceCurrency = $priceCurrency;
     $this->_maliciousCode = $maliciousCode;
     parent::__construct($context, $data);
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:14,代碼來源:AbstractEmail.php

示例7: __construct

 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Wishlist\Helper\Data $wishlistHelper
  * @param \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder
  * @param \Magento\Framework\Url\EncoderInterface $urlEncoder
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Wishlist\Helper\Data $wishlistHelper, \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder, \Magento\Framework\Url\EncoderInterface $urlEncoder, array $data = [])
 {
     parent::__construct($context, $data);
     $this->wishlistHelper = $wishlistHelper;
     $this->rssUrlBuilder = $rssUrlBuilder;
     $this->urlEncoder = $urlEncoder;
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:14,代碼來源:Link.php

示例8: __construct

 /**
  * PHP Constructor
  *
  * @param \Magento\Framework\View\Element\Template\Context $context       App context
  * @param \Magento\Framework\Json\Helper\Data              $jsonHelper    The Magento's JSON Helper
  * @param \Smile\ElasticsuiteTracker\Helper\Data           $trackerHelper The Smile Tracker helper
  * @param \Magento\Framework\Registry                      $registry      The Magento registry
  * @param array                                            $data          additional datas
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Json\Helper\Data $jsonHelper, \Smile\ElasticsuiteTracker\Helper\Data $trackerHelper, \Magento\Framework\Registry $registry, array $data = [])
 {
     parent::__construct($context, $data);
     $this->jsonHelper = $jsonHelper;
     $this->trackerHelper = $trackerHelper;
     $this->registry = $registry;
 }
開發者ID:smile-sa,項目名稱:elasticsuite,代碼行數:16,代碼來源:AbstractBlock.php

示例9: __construct

 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Sales\Model\OrderFactory $orderFactory
  * @param array $data
  * @codeCoverageIgnore
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Catalog\Model\Session $catalogSession, \Magento\Checkout\Model\Session $checkoutSession, array $data = [])
 {
     $this->_orderFactory = $orderFactory;
     $this->_catalogSession = $catalogSession;
     $this->_checkoutSession = $checkoutSession;
     parent::__construct($context, $data);
 }
開發者ID:AmrHassanien,項目名稱:magento-prototype,代碼行數:13,代碼來源:ShoppreeSuccess.php

示例10: __construct

 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Customer\Helper\Address $addressHelper
  * @param CustomerMetadataInterface $customerMetadata
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Customer\Helper\Address $addressHelper, CustomerMetadataInterface $customerMetadata, array $data = [])
 {
     $this->_addressHelper = $addressHelper;
     $this->customerMetadata = $customerMetadata;
     parent::__construct($context, $data);
     $this->_isScopePrivate = true;
 }
開發者ID:tingyeeh,項目名稱:magento2,代碼行數:13,代碼來源:AbstractWidget.php

示例11: __construct

 public function __construct(\Dotdigitalgroup\Email\Helper\Data $helper, \Magento\Framework\ObjectManagerInterface $objectManagerInterface, \Magento\Backend\Block\Template\Context $context)
 {
     $data = [];
     $this->_helper = $helper;
     $this->_objectManager = $objectManagerInterface;
     parent::__construct($context, $data);
 }
開發者ID:dragonsword007008,項目名稱:magento2,代碼行數:7,代碼來源:Stats.php

示例12: __construct

 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Customer\Model\Session $customerSession
  * @param \Magento\Checkout\Model\Session $checkoutSession
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Customer\Model\Session $customerSession, \Magento\Checkout\Model\Session $checkoutSession, array $data = [])
 {
     $this->_customerSession = $customerSession;
     $this->_checkoutSession = $checkoutSession;
     parent::__construct($context, $data);
     $this->_isScopePrivate = true;
 }
開發者ID:nja78,項目名稱:magento2,代碼行數:13,代碼來源:AbstractCart.php

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

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

示例15: _construct

 protected function _construct()
 {
     parent::_construct();
     // CSRF protection
     $this->_customerSession->setFacebookCsrf($csrf = md5(uniqid(rand(), true)));
     $this->_clientFacebook->setState($csrf);
 }
開發者ID:LavoWeb,項目名稱:Magento2-Inchoo_SocialConnect,代碼行數:7,代碼來源:Button.php


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