本文整理汇总了PHP中Magento\Framework\View\Page\Config::addPageAsset方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::addPageAsset方法的具体用法?PHP Config::addPageAsset怎么用?PHP Config::addPageAsset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\View\Page\Config
的用法示例。
在下文中一共展示了Config::addPageAsset方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareFavicon
/**
* @return void
*/
public function prepareFavicon()
{
if ($this->pageConfig->getFaviconFile()) {
$this->pageConfig->addRemotePageAsset($this->pageConfig->getFaviconFile(), Generator\Head::VIRTUAL_CONTENT_TYPE_LINK, ['attributes' => ['rel' => 'icon', 'type' => 'image/x-icon']], 'icon');
$this->pageConfig->addRemotePageAsset($this->pageConfig->getFaviconFile(), Generator\Head::VIRTUAL_CONTENT_TYPE_LINK, ['attributes' => ['rel' => 'shortcut icon', 'type' => 'image/x-icon']], 'shortcut-icon');
} else {
$this->pageConfig->addPageAsset($this->pageConfig->getDefaultFavicon(), ['attributes' => ['rel' => 'icon', 'type' => 'image/x-icon']], 'icon');
$this->pageConfig->addPageAsset($this->pageConfig->getDefaultFavicon(), ['attributes' => ['rel' => 'shortcut icon', 'type' => 'image/x-icon']], 'shortcut-icon');
}
}
示例2: processAssets
/**
* Add assets to page config
*
* @param \Magento\Framework\View\Page\Config\Structure $pageStructure
* @return $this
*/
protected function processAssets(Structure $pageStructure)
{
foreach ($pageStructure->getAssets() as $name => $data) {
if (isset($data['src_type']) && in_array($data['src_type'], $this->remoteAssetTypes)) {
$this->pageConfig->addRemotePageAsset($name, self::VIRTUAL_CONTENT_TYPE_LINK, $this->getAssetProperties($data));
} else {
$this->pageConfig->addPageAsset($name, $this->getAssetProperties($data));
}
}
return $this;
}
示例3: testAddPageAsset
/**
* @param string $file
* @param array $properties
* @param string|null $name
* @param string $expectedName
*
* @dataProvider pageAssetDataProvider
*/
public function testAddPageAsset($file, $properties, $name, $expectedName)
{
$this->assetRepo->expects($this->once())->method('createAsset')->with($file)->will(
$this->returnValue($this->asset)
);
$this->pageAssets->expects($this->once())->method('add')->with($expectedName, $this->asset, $properties);
$this->assertInstanceOf(
'Magento\Framework\View\Page\Config',
$this->model->addPageAsset($file, $properties, $name)
);
}
示例4: addPageAsset
/**
* {@inheritdoc}
*/
public function addPageAsset($file, array $properties = array(), $name = null)
{
$pluginInfo = $this->pluginList->getNext($this->subjectType, 'addPageAsset');
if (!$pluginInfo) {
return parent::addPageAsset($file, $properties, $name);
} else {
return $this->___callPlugins('addPageAsset', func_get_args(), $pluginInfo);
}
}