本文整理汇总了PHP中Magento\Framework\View\Element\Template类的典型用法代码示例。如果您正苦于以下问题:PHP Template类的具体用法?PHP Template怎么用?PHP Template使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Template类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: __construct
/**
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Wishlist\Helper\Data $wishlistData
* @param \Magento\Wishlist\Model\Config $wishlistConfig
* @param array $data
*/
public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Wishlist\Helper\Data $wishlistData, \Magento\Wishlist\Model\Config $wishlistConfig, array $data = [])
{
$this->_wishlistData = $wishlistData;
$this->_wishlistConfig = $wishlistConfig;
parent::__construct($context, $data);
$this->_isScopePrivate = true;
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:13,代码来源:Button.php
示例14: __construct
/**
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Catalog\Helper\Category $categoryHelper
* @param array $data
*/
public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Catalog\Helper\Category $categoryHelper, \Magento\Catalog\Model\Indexer\Category\Flat\State $categoryFlatState, \Magento\Theme\Block\Html\Topmenu $topMenu)
{
$this->_categoryHelper = $categoryHelper;
$this->categoryFlatConfig = $categoryFlatState;
$this->topMenu = $topMenu;
parent::__construct($context);
}
开发者ID:Doability,项目名称:magento2dev,代码行数:12,代码来源:CategorisCollection.php
示例15: __construct
/**
* Constructor
*
* @param TemplateContext $context
* @param UiComponentInterface $component
* @param BlockFactory $blockWrapperFactory
* @param array $data
*/
public function __construct(TemplateContext $context, UiComponentInterface $component, BlockFactory $blockWrapperFactory, array $data = [])
{
$this->component = $component;
$this->blockWrapperFactory = $blockWrapperFactory;
$this->setNameInLayout($this->component->getName());
parent::__construct($context, $data);
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:15,代码来源:UiComponent.php
示例16: __construct
/**
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\App\Http\Context $httpContext
* @param array $data
*/
public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Registry $registry, \Magento\Framework\App\Http\Context $httpContext, array $data = [])
{
$this->_coreRegistry = $registry;
$this->httpContext = $httpContext;
parent::__construct($context, $data);
$this->_isScopePrivate = true;
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:13,代码来源:Buttons.php
示例17: __construct
/**
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory $setColFactory
* @param \Magento\Framework\Registry $registry
* @param \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper
* @param array $data
*/
public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory $setColFactory, \Magento\Framework\Registry $registry, \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper, array $data = [])
{
$this->_setColFactory = $setColFactory;
$this->_coreRegistry = $registry;
$this->_resourceHelper = $resourceHelper;
parent::__construct($context, $data);
}
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:14,代码来源:TemplateSelector.php
示例18: __construct
/**
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\ProductAlert\Helper\Data $helper
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\Data\Helper\PostHelper $coreHelper
* @param array $data
*/
public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\ProductAlert\Helper\Data $helper, \Magento\Framework\Registry $registry, \Magento\Framework\Data\Helper\PostHelper $coreHelper, array $data = [])
{
parent::__construct($context, $data);
$this->_registry = $registry;
$this->_helper = $helper;
$this->coreHelper = $coreHelper;
}
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:14,代码来源:View.php
示例19: __construct
/**
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Review\Model\Resource\Review\CollectionFactory $collectionFactory
* @param array $data
*/
public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\Registry $registry, \Magento\Review\Model\Resource\Review\CollectionFactory $collectionFactory, array $data = [])
{
$this->_coreRegistry = $registry;
$this->_reviewsColFactory = $collectionFactory;
parent::__construct($context, $data);
$this->setTabTitle();
}
开发者ID:shabbirvividads,项目名称:magento2,代码行数:13,代码来源:Review.php
示例20: _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
注:本文中的Magento\Framework\View\Element\Template类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论