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


PHP Repository::getUrlWithParams方法代码示例

本文整理汇总了PHP中Magento\Framework\View\Asset\Repository::getUrlWithParams方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::getUrlWithParams方法的具体用法?PHP Repository::getUrlWithParams怎么用?PHP Repository::getUrlWithParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\View\Asset\Repository的用法示例。


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

示例1: getViewFileUrl

 /**
  * Retrieve url of a view file
  *
  * @param string $fileId
  * @param array $params
  * @return string
  */
 public function getViewFileUrl($fileId, array $params = [])
 {
     try {
         $params = array_merge(['_secure' => $this->_request->isSecure()], $params);
         return $this->_assetRepo->getUrlWithParams($fileId, $params);
     } catch (\Magento\Framework\Exception\LocalizedException $e) {
         return '';
     }
 }
开发者ID:smart2pay,项目名称:magento20,代码行数:16,代码来源:ConfigProvider.php

示例2: getBaseUrl

 /**
  * Return the tracking base URL (params are added later)
  *
  * @return string
  */
 public function getBaseUrl()
 {
     $result = $this->scopeConfig->getValue(self::CONFIG_BASE_URL_XPATH);
     if (!$result) {
         $params = ['_secure' => $this->_getRequest()->isSecure()];
         return $this->assetRepository->getUrlWithParams("Smile_ElasticsuiteTracker::hit.png", $params);
     }
     return $result;
 }
开发者ID:smile-sa,项目名称:elasticsuite,代码行数:14,代码来源:Data.php

示例3: getLogoUrl

 protected function getLogoUrl($code)
 {
     //$params = array_merge(['_secure' => $this->getRequest()->isSecure()], $params);
     $logo = $this->methods[$code]->getLogo();
     if ($logo === false) {
         return false;
     }
     return $this->assetRepo->getUrlWithParams('Wirecard_CheckoutPage::images/' . $logo, ['_secure' => true]);
 }
开发者ID:wirecard,项目名称:magento2-wcp,代码行数:9,代码来源:ConfigProvider.php

示例4: getViewFileUrl

 /**
  * Retrieve url of a view file
  *
  * @param string $fileId
  * @param array $params
  * @return string[]
  */
 protected function getViewFileUrl($fileId, array $params = [])
 {
     try {
         $params = array_merge(['_secure' => $this->request->isSecure()], $params);
         return $this->assetRepo->getUrlWithParams($fileId, $params);
     } catch (LocalizedException $e) {
         $this->logger->critical($e);
         return $this->urlBuilder->getUrl('', ['_direct' => 'core/index/notFound']);
     }
 }
开发者ID:kid17,项目名称:magento2,代码行数:17,代码来源:IframeConfigProvider.php

示例5: testGetUrl

 /**
  * @return void
  */
 public function testGetUrl()
 {
     $themeMock = $this->getMock('Magento\\Framework\\View\\Design\\ThemeInterface', [], [], '', false);
     $this->designMock->expects($this->any())->method('getDesignParams')->willReturn(['themeModel' => $themeMock, 'area' => 'area', 'locale' => 'locale']);
     $assetMock = $this->getMockBuilder('Magento\\Framework\\View\\Asset\\File')->disableOriginalConstructor()->getMock();
     $assetMock->expects($this->any())->method('getUrl')->willReturn('some url');
     $this->fileFactoryMock->expects($this->exactly(2))->method('create')->with(['source' => $this->sourceMock, 'context' => '', 'filePath' => 'test/file.js', 'module' => '', 'contentType' => ''])->willReturn($assetMock);
     $this->assertEquals('some url', $this->repository->getUrl('test/file.js'));
     $this->assertEquals('some url', $this->repository->getUrlWithParams('test/file.js', []));
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:13,代码来源:RepositoryTest.php

示例6: testGetUrlWithParams

 public function testGetUrlWithParams()
 {
     $defaultTheme = $this->getMockForAbstractClass('Magento\\Framework\\View\\Design\\ThemeInterface');
     $defaults = ['area' => 'area', 'themeModel' => $defaultTheme, 'locale' => 'locale'];
     $this->design->expects($this->atLeastOnce())->method('getDesignParams')->will($this->returnValue($defaults));
     $this->design->expects($this->once())->method('getConfigurationDesignTheme')->with('custom_area')->will($this->returnValue(false));
     $this->design->expects($this->any())->method('getThemePath')->with($this->theme)->will($this->returnValue('custom_theme'));
     $this->baseUrl->expects($this->once())->method('getBaseUrl')->will($this->returnValue('http://example.com/static/'));
     $params = ['area' => 'custom_area', 'locale' => 'en_US', 'module' => 'This_Shall_Not_Be_Used'];
     $result = $this->object->getUrlWithParams('Module_Name::file.ext', $params);
     $this->assertEquals('http://example.com/static/custom_area/custom_theme/en_US/Module_Name/file.ext', $result);
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:12,代码来源:RepositoryTest.php

示例7: viewDirective

 /**
  * Retrieve View URL directive
  *
  * @param array $construction
  * @return string
  * @see \Magento\Email\Model\Template\Filter::viewDirective() method has been copypasted
  */
 public function viewDirective($construction)
 {
     $params = $this->getParameters($construction[2]);
     $params['_absolute'] = $this->_useAbsoluteLinks;
     /**
      * @bug: the "_absolute" key is not supported by underlying services
      * probably this happened because of multitude of refactorings in past
      * The original intent of _absolute parameter was to simply append specified path to a base URL
      * bypassing any kind of processing.
      * For example, normally you would use {{view url="css/styles.css"}} directive which would automatically resolve
      * into something like http://example.com/pub/static/area/theme/en_US/css/styles.css
      * But with _absolute, the expected behavior is this: {{view url="favicon.ico" _absolute=true}} should resolve
      * into something like http://example.com/favicon.ico
      *
      * To fix the issue, it is better not to maintain the _absolute parameter anymore in undrelying services,
      * but instead just create a different type of directive, for example {{baseUrl path="favicon.ico"}}
      */
     $url = $this->_assetRepo->getUrlWithParams($params['url'], $params);
     return $url;
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:27,代码来源:Filter.php

示例8: getViewFileUrl

 /**
  * Retrieve url of a view file
  *
  * @param string $fileId
  * @param array $params
  * @return string
  */
 public function getViewFileUrl($fileId, array $params = [])
 {
     try {
         $params = array_merge(['_secure' => $this->getRequest()->isSecure()], $params);
         return $this->_assetRepo->getUrlWithParams($fileId, $params);
     } catch (\Magento\Framework\Exception\LocalizedException $e) {
         $this->_logger->critical($e);
         return $this->_getNotFoundUrl();
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:17,代码来源:AbstractBlock.php

示例9: viewDirective

 /**
  * Retrieve View URL directive
  *
  * @param string[] $construction
  * @return string
  */
 public function viewDirective($construction)
 {
     $params = $this->_getParameters($construction[2]);
     $url = $this->_assetRepo->getUrlWithParams($params['url'], $params);
     return $url;
 }
开发者ID:niranjanssiet,项目名称:magento2,代码行数:12,代码来源:Filter.php

示例10: getDefaultEmailLogo

 /**
  * Get default email logo image
  *
  * @return string
  */
 public function getDefaultEmailLogo()
 {
     $designParams = $this->getDesignParams();
     return $this->assetRepo->getUrlWithParams(self::DEFAULT_LOGO_FILE_ID, $designParams);
 }
开发者ID:nja78,项目名称:magento2,代码行数:10,代码来源:AbstractTemplate.php

示例11: getDefaultEmailLogo

 /**
  * Get default email logo image
  *
  * @return string
  */
 public function getDefaultEmailLogo()
 {
     return $this->_assetRepo->getUrlWithParams('Magento_Email::logo_email.gif', array('area' => \Magento\Framework\App\Area::AREA_FRONTEND));
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:9,代码来源:Template.php

示例12: getPreviewImageUrl

 /**
  * Get url to preview image
  *
  * @param \Magento\Core\Model\Theme|ThemeInterface $theme
  * @return string
  */
 public function getPreviewImageUrl(ThemeInterface $theme)
 {
     return $theme->isPhysical() ? $this->assetRepo->getUrlWithParams($theme->getPreviewImage(), ['area' => $theme->getData('area'), 'themeModel' => $theme]) : $this->storeManager->getStore()->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_MEDIA) . self::PREVIEW_DIRECTORY_PATH . '/' . $theme->getPreviewImage();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:10,代码来源:Path.php


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