Skip to content

Commit d95fb8d

Browse files
authored
Support controller src_type for head links
1 parent 35e2dbb commit d95fb8d

File tree

1 file changed

+18
-4
lines changed
  • lib/internal/Magento/Framework/View/Page/Config/Generator

1 file changed

+18
-4
lines changed

lib/internal/Magento/Framework/View/Page/Config/Generator/Head.php

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,23 @@ class Head implements Layout\GeneratorInterface
5757
*/
5858
protected $pageConfig;
5959

60+
/**
61+
* @var \Magento\Framework\UrlInterface
62+
*/
63+
protected $url;
64+
6065
/**
6166
* Constructor
6267
*
6368
* @param \Magento\Framework\View\Page\Config $pageConfig
69+
* @param \Magento\Framework\UrlInterface $url
6470
*/
65-
public function __construct(\Magento\Framework\View\Page\Config $pageConfig)
66-
{
71+
public function __construct(
72+
\Magento\Framework\View\Page\Config $pageConfig,
73+
\Magento\Framework\UrlInterface $url
74+
) {
6775
$this->pageConfig = $pageConfig;
76+
$this->url = $url;
6877
}
6978

7079
/**
@@ -107,10 +116,15 @@ protected function processAssets(Structure $pageStructure)
107116
{
108117
foreach ($pageStructure->getAssets() as $name => $data) {
109118
if (isset($data['src_type']) && in_array($data['src_type'], $this->remoteAssetTypes)) {
119+
if ($data['src_type'] === self::SRC_TYPE_CONTROLLER) {
120+
$data['src'] = $this->url->getUrl($data['src']);
121+
}
122+
110123
$this->pageConfig->addRemotePageAsset(
111-
$name,
124+
$data['src'],
112125
isset($data['content_type']) ? $data['content_type'] : self::VIRTUAL_CONTENT_TYPE_LINK,
113-
$this->getAssetProperties($data)
126+
$this->getAssetProperties($data),
127+
$name
114128
);
115129
} else {
116130
$this->pageConfig->addPageAsset($name, $this->getAssetProperties($data));

0 commit comments

Comments
 (0)