本文整理汇总了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 '';
}
}
示例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;
}
示例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]);
}
示例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']);
}
}
示例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', []));
}
示例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);
}
示例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;
}
示例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();
}
}
示例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;
}
示例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);
}
示例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));
}
示例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();
}