当前位置: 首页>>代码示例>>PHP>>正文


PHP Template\Context类代码示例

本文整理汇总了PHP中Magento\Framework\View\Element\Template\Context的典型用法代码示例。如果您正苦于以下问题:PHP Context类的具体用法?PHP Context怎么用?PHP Context使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Context类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 /**
  * {@inheritDoc}
  */
 protected function setUp()
 {
     $this->contextMock = $this->getMockBuilder('Magento\\Framework\\View\\Element\\Template\\Context')->disableOriginalConstructor()->setMethods(['getUrlBuilder'])->getMock();
     $this->urlBuilderMock = $this->getMockBuilder('Magento\\Framework\\UrlInterface')->disableOriginalConstructor()->getMock();
     $this->contextMock->expects($this->any())->method('getUrlBuilder')->willReturn($this->urlBuilderMock);
     $this->contactForm = new ContactForm($this->contextMock);
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:10,代码来源:ContactFormTest.php

示例2: __construct

 /**
  * Constructor
  *
  * @param TemplateContext $context
  * @param Context $renderContext
  * @param ContentTypeFactory $contentTypeFactory
  * @param ConfigFactory $configFactory
  * @param ConfigBuilderInterface $configBuilder
  * @param DataProviderFactory $dataProviderFactory
  * @param Manager $dataProviderManager
  * @param FilterPool $filterPool
  * @param ResolverInterface $localeResolver
  * @param array $data
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(TemplateContext $context, Context $renderContext, ContentTypeFactory $contentTypeFactory, ConfigFactory $configFactory, ConfigBuilderInterface $configBuilder, DataProviderFactory $dataProviderFactory, Manager $dataProviderManager, FilterPool $filterPool, ResolverInterface $localeResolver, array $data = [])
 {
     $this->localeDate = $context->getLocaleDate();
     $this->scopeConfig = $context->getScopeConfig();
     $this->localeResolver = $localeResolver;
     parent::__construct($context, $renderContext, $contentTypeFactory, $configFactory, $configBuilder, $dataProviderFactory, $dataProviderManager, $filterPool, $data);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:22,代码来源:Date.php

示例3: __construct

 /**
  * Constructor
  *
  * @param Context         $context
  * @param Config          $config
  * @param FormatInterface $localeFormat
  * @param SearchHelper    $searchHelper
  */
 public function __construct(Context $context, Config $config, FormatInterface $localeFormat, SearchHelper $searchHelper)
 {
     $this->storeManager = $context->getStoreManager();
     $this->config = $config;
     $this->localeFormat = $localeFormat;
     $this->searchHelper = $searchHelper;
     parent::__construct($context);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:16,代码来源:Injection.php

示例4: __construct

 /**
  * Validate3d constructor.
  *
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param array $data
  * @param \Magento\Sales\Model\OrderFactory $orderFactory
  * @param \Magento\Checkout\Model\Session $checkoutSession
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, array $data = [], \Magento\Sales\Model\OrderFactory $orderFactory, \Magento\Checkout\Model\Session $checkoutSession)
 {
     $this->_orderFactory = $orderFactory;
     $this->_checkoutSession = $checkoutSession;
     $this->_request = $context->getRequest();
     parent::__construct($context, $data);
     $this->_getOrder();
 }
开发者ID:Adyen,项目名称:adyen-magento2,代码行数:16,代码来源:Validate3d.php

示例5: __construct

 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Catalog\Helper\Image $imageHelper
  * @param \Magento\Catalog\Model\Rss\Product\NewProducts $rssModel
  * @param \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Catalog\Helper\Image $imageHelper, \Magento\Catalog\Model\Rss\Product\NewProducts $rssModel, \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder, array $data = [])
 {
     $this->imageHelper = $imageHelper;
     $this->rssModel = $rssModel;
     $this->rssUrlBuilder = $rssUrlBuilder;
     $this->storeManager = $context->getStoreManager();
     parent::__construct($context, $data);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:15,代码来源:NewProducts.php

示例6: __construct

 public function __construct(Template\Context $context, \Celebros\ConversionPro\Helper\Data $helper, \Celebros\ConversionPro\Helper\Search $searchHelper, \Magento\Framework\Registry $registry, array $data = [])
 {
     $this->helper = $helper;
     $this->searchHelper = $searchHelper;
     $this->registry = $registry;
     $this->url = $context->getUrlBuilder();
     parent::__construct($context, $data);
 }
开发者ID:devbelvg,项目名称:M2_ConversionPro_Embedded,代码行数:8,代码来源:View.php

示例7: __construct

 public function __construct(Context $context, HelperData $helperData, ObjectManagerInterface $objectManager, array $data = [])
 {
     $this->helperData = $helperData;
     $this->objectManager = $objectManager;
     //$this->storeManager  = $storeManager;
     $this->localeDate = $context->getLocaleDate();
     parent::__construct($context, $data);
 }
开发者ID:mageplaza,项目名称:magento-2-blog-extension,代码行数:8,代码来源:Frontend.php

示例8: __construct

 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Framework\App\Http\Context $httpContext
  * @param \Magento\SalesRule\Model\Rss\Discounts $rssModel
  * @param \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Framework\App\Http\Context $httpContext, \Magento\SalesRule\Model\Rss\Discounts $rssModel, \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder, array $data = [])
 {
     $this->storeManager = $context->getStoreManager();
     $this->rssModel = $rssModel;
     $this->httpContext = $httpContext;
     $this->rssUrlBuilder = $rssUrlBuilder;
     parent::__construct($context, $data);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:15,代码来源:Discounts.php

示例9: __construct

 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Catalog\Helper\Image $imageHelper
  * @param \Magento\Catalog\Model\Rss\Product\NewProducts $rssModel
  * @param \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder
  * @param array $data
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Mageplaza\Blog\Model\CategoryFactory $rssModel, \Mageplaza\Blog\Helper\Data $helper, \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder, array $data = [])
 {
     $this->helper = $helper;
     $this->rssModel = $rssModel;
     $this->rssUrlBuilder = $rssUrlBuilder;
     $this->storeManager = $context->getStoreManager();
     parent::__construct($context, $data);
 }
开发者ID:mageplaza,项目名称:magento-2-blog-extension,代码行数:15,代码来源:Category.php

示例10: __construct

 /**
  * @param Context $context
  * @param DataStore $dataStore
  * @param MagentoAPI $magentoAPI
  * @param UrlInterface $urlBuilder
  */
 public function __construct(Context $context, DataStore $dataStore, MagentoAPI $magentoAPI, UrlInterface $urlBuilder)
 {
     $this->assetRepository = $context->getAssetRepository();
     $this->dataStore = $dataStore;
     $this->magentoAPI = $magentoAPI;
     $this->logger = $context->getLogger();
     $this->urlBuilder = $urlBuilder;
     parent::__construct($context);
 }
开发者ID:cloudflare,项目名称:cloudflare-magento,代码行数:15,代码来源:Index.php

示例11: __construct

 /**
  * @param \Magento\Framework\View\Element\Template\Context $context
  * @param \Magento\Catalog\Model\CategoryFactory $categoryFactory
  * @param \Magento\Catalog\Model\Rss\Category $rssModel
  * @param \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder
  * @param \Magento\Catalog\Helper\Image $imageHelper
  * @param \Magento\Customer\Model\Session $customerSession
  * @param CategoryRepositoryInterface $categoryRepository
  * @param array $data
  * @SuppressWarnings(PHPMD.ExcessiveParameterList)
  */
 public function __construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Catalog\Model\CategoryFactory $categoryFactory, \Magento\Catalog\Model\Rss\Category $rssModel, \Magento\Framework\App\Rss\UrlBuilderInterface $rssUrlBuilder, \Magento\Catalog\Helper\Image $imageHelper, \Magento\Customer\Model\Session $customerSession, CategoryRepositoryInterface $categoryRepository, array $data = [])
 {
     $this->imageHelper = $imageHelper;
     $this->categoryFactory = $categoryFactory;
     $this->customerSession = $customerSession;
     $this->rssModel = $rssModel;
     $this->rssUrlBuilder = $rssUrlBuilder;
     $this->storeManager = $context->getStoreManager();
     $this->categoryRepository = $categoryRepository;
     parent::__construct($context, $data);
 }
开发者ID:tingyeeh,项目名称:magento2,代码行数:22,代码来源:Category.php

示例12: setUp

 protected function setUp()
 {
     $this->contextMock = $this->getMockBuilder('Magento\\Framework\\View\\Element\\Template\\Context')->disableOriginalConstructor()->getMock();
     $this->sessionConfigMock = $this->getMockBuilder('Magento\\Framework\\Session\\Config')->disableOriginalConstructor()->getMock();
     $this->ipValidatorMock = $this->getMockBuilder('Magento\\Framework\\Validator\\Ip')->disableOriginalConstructor()->getMock();
     $validtorMock = $this->getMockBuilder('Magento\\Framework\\View\\Element\\Template\\File\\Validator')->setMethods(['isValid'])->disableOriginalConstructor()->getMock();
     $scopeConfigMock = $this->getMockBuilder('Magento\\Framework\\App\\Config')->setMethods(['isSetFlag'])->disableOriginalConstructor()->getMock();
     $this->contextMock->expects($this->any())->method('getScopeConfig')->will($this->returnValue($scopeConfigMock));
     $this->contextMock->expects($this->any())->method('getValidator')->will($this->returnValue($validtorMock));
     $this->model = new \Magento\Framework\View\Element\Js\Cookie($this->contextMock, $this->sessionConfigMock, $this->ipValidatorMock, []);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:11,代码来源:CookieTest.php

示例13: setUp

 protected function setUp()
 {
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->context = $this->getMockBuilder('Magento\\Framework\\App\\Action\\Context')->disableOriginalConstructor()->setMethods(['getRequest', 'getResponse'])->getMock();
     $this->response = $this->getMockBuilder('Magento\\Framework\\App\\Response\\Http')->disableOriginalConstructor()->getMock();
     $this->context->expects($this->once())->method('getResponse')->willReturn($this->response);
     $this->request = $this->getMockBuilder('Magento\\Framework\\App\\RequestInterface')->getMockForAbstractClass();
     $this->context->expects($this->once())->method('getRequest')->willReturn($this->request);
     $this->feedRepository = $this->getMockBuilder('Magento\\SampleServiceContractNew\\API\\FeedRepositoryInterface')->getMockForAbstractClass();
     $this->feedTransformer = $this->getMockBuilder('Magento\\SampleServiceContractNew\\Model\\FeedTransformer')->disableOriginalConstructor()->getMock();
     $this->controller = $objectManager->getObject('Magento\\SampleServiceContractNew\\Controller\\Feed\\View', ['feedRepository' => $this->feedRepository, 'feedTransformer' => $this->feedTransformer, 'context' => $this->context]);
 }
开发者ID:imbrj,项目名称:magento2-samples,代码行数:12,代码来源:ViewTest.php

示例14: setUp

 protected function setUp()
 {
     $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->context = $this->getMockBuilder('Magento\\Framework\\View\\Element\\Template\\Context')->disableOriginalConstructor()->setMethods(['getRequest'])->getMock();
     $this->request = $this->getMockBuilder('Magento\\Framework\\App\\RequestInterface')->getMockForAbstractClass();
     $this->context->expects($this->once())->method('getRequest')->willReturn($this->request);
     $this->productTypeList = $this->getMockBuilder('Magento\\Catalog\\Api\\ProductTypeListInterface')->getMockForAbstractClass();
     $this->productRepository = $this->getMockBuilder('Magento\\Catalog\\Api\\ProductRepositoryInterface')->getMockForAbstractClass();
     $this->searchCriteriaBuilder = $this->getMockBuilder('Magento\\Framework\\Api\\SearchCriteriaBuilder')->disableOriginalConstructor()->getMock();
     $this->filterBuilder = $this->getMockBuilder('Magento\\Framework\\Api\\FilterBuilder')->disableOriginalConstructor()->getMock();
     $this->block = $objectManager->getObject('Magento\\SampleServiceContractClient\\Block\\ProductList', ['context' => $this->context, 'productTypeList' => $this->productTypeList, 'productRepository' => $this->productRepository, 'searchCriteriaBuilder' => $this->searchCriteriaBuilder, 'filterBuilder' => $this->filterBuilder]);
 }
开发者ID:luo3555,项目名称:magento2-samples,代码行数:12,代码来源:ProductListTest.php

示例15: setUp

 protected function setUp()
 {
     $this->storeManager = $this->getMock('\\Magento\\Framework\\StoreManagerInterface');
     $this->context = $this->getMock('Magento\\Framework\\View\\Element\\Template\\Context', array(), array(), '', false);
     $this->context->expects($this->any())->method('getStoreManager')->will($this->returnValue($this->storeManager));
     $this->collection = $this->getMock('Magento\\Review\\Model\\Resource\\Review\\Product\\Collection', array(), array(), '', false);
     $this->collectionFactory = $this->getMock('Magento\\Review\\Model\\Resource\\Review\\Product\\CollectionFactory', array('create'), array(), '', false);
     $this->collectionFactory->expects($this->once())->method('create')->will($this->returnValue($this->collection));
     $this->currentCustomer = $this->getMock('Magento\\Customer\\Helper\\Session\\CurrentCustomer', array(), array(), '', false);
     $this->objectManagerHelper = new ObjectManagerHelper($this);
     $this->object = $this->objectManagerHelper->getObject('Magento\\Review\\Block\\Customer\\Recent', array('context' => $this->context, 'collectionFactory' => $this->collectionFactory, 'currentCustomer' => $this->currentCustomer));
 }
开发者ID:buskamuza,项目名称:magento2-skeleton,代码行数:12,代码来源:RecentTest.php


注:本文中的Magento\Framework\View\Element\Template\Context类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。