87 $resultAttributes = [];
88 foreach ($this->pageConfig->getElementAttributes($elementType) as
$name =>
$value) {
89 $resultAttributes[] = sprintf(
'%s="%s"',
$name,
$value);
91 return implode(
' ', $resultAttributes);
106 $result .= $this->pageConfig->getIncludes();
117 return '<title>' . $this->escaper->escapeHtml($this->pageConfig->getTitle()->get()) .
'</title>' .
"\n";
128 foreach ($this->pageConfig->getMetadata() as
$name =>
$content) {
130 if (!$metadataTemplate) {
150 $method =
'get' . $this->
string->upperCaseWords(
$name,
'_',
'');
151 if (
$name ===
'title') {
153 $content = $this->escaper->escapeHtml($this->pageConfig->$method()->get());
157 if (method_exists($this->pageConfig,
$method)) {
158 $content = $this->pageConfig->$method();
171 if (strpos(
$name,
'og:') === 0) {
172 return '<meta property="' .
$name .
'" content="%content"/>' .
"\n";
176 case Config::META_CHARSET:
177 $metadataTemplate =
'<meta charset="%content"/>' .
"\n";
180 case Config::META_CONTENT_TYPE:
181 $metadataTemplate =
'<meta http-equiv="Content-Type" content="%content"/>' .
"\n";
184 case Config::META_X_UI_COMPATIBLE:
185 $metadataTemplate =
'<meta http-equiv="X-UA-Compatible" content="%content"/>' .
"\n";
188 case Config::META_MEDIA_TYPE:
189 $metadataTemplate =
false;
193 $metadataTemplate =
'<meta name="%name" content="%content"/>' .
"\n";
196 return $metadataTemplate;
206 if ($this->pageConfig->getFaviconFile()) {
207 $this->pageConfig->addRemotePageAsset(
208 $this->pageConfig->getFaviconFile(),
210 [
'attributes' => [
'rel' =>
'icon',
'type' =>
'image/x-icon']],
213 $this->pageConfig->addRemotePageAsset(
214 $this->pageConfig->getFaviconFile(),
216 [
'attributes' => [
'rel' =>
'shortcut icon',
'type' =>
'image/x-icon']],
220 $this->pageConfig->addPageAsset(
221 $this->pageConfig->getDefaultFavicon(),
222 [
'attributes' => [
'rel' =>
'icon',
'type' =>
'image/x-icon']],
225 $this->pageConfig->addPageAsset(
226 $this->pageConfig->getDefaultFavicon(),
227 [
'attributes' => [
'rel' =>
'shortcut icon',
'type' =>
'image/x-icon']],
243 foreach ($this->pageConfig->getAssetCollection()->getGroups() as
$group) {
244 $type =
$group->getProperty(GroupedCollection::PROPERTY_CONTENT_TYPE);
245 if (!isset($resultGroups[
$type])) {
246 $resultGroups[
$type] =
'';
250 return implode(
'', $resultGroups);
261 $groupHtml = $this->renderAssetHtml(
$group);
275 if (
$group->getProperty(GroupedCollection::PROPERTY_CAN_MERGE) && count($groupAssets) > 1) {
276 $groupAssets = $this->assetMergeService->getMergedAssets(
278 $group->getProperty(GroupedCollection::PROPERTY_CONTENT_TYPE)
295 $attributesString =
'';
297 $attributesString .=
' ' .
$name .
'="' . $this->escaper->escapeHtml(
$value) .
'"';
316 switch ($contentType) {
337 switch ($contentType) {
339 $groupTemplate =
'<script ' .
$attributes .
' src="%s"></script>' .
"\n";
344 $groupTemplate =
'<link ' .
$attributes .
' href="%s" />' .
"\n";
347 return $groupTemplate;
359 $ieCondition =
$group->getProperty(
'ie_condition');
360 if (!empty($ieCondition)) {
361 $groupHtml =
'<!--[if ' . $ieCondition .
']>' .
"\n" . $groupHtml .
'<![endif]-->' .
"\n";
380 foreach ($assets as $asset) {
382 $group->getProperty(GroupedCollection::PROPERTY_CONTENT_TYPE),
388 $this->logger->critical($e);
389 $result .= sprintf(
$template, $this->urlBuilder->getUrl(
'', [
'_direct' =>
'core/index/notFound']));
402 return $asset->getContentType();
412 return array_fill_keys($this->assetTypeOrder,
'');
getMetadataTemplate($name)
getAvailableResultGroups()
processMetadataContent($name, $content)
const VIRTUAL_CONTENT_TYPE_LINK
__construct(Config $pageConfig, \Magento\Framework\View\Asset\MergeService $assetMergeService, \Magento\Framework\UrlInterface $urlBuilder, \Magento\Framework\Escaper $escaper, \Magento\Framework\Stdlib\StringUtils $string, \Psr\Log\LoggerInterface $logger)
processIeCondition($groupHtml, $group)
renderAssetGroup(\Magento\Framework\View\Asset\PropertyGroup $group)
getGroupAttributes($group)
getAssetTemplate($contentType, $attributes)
getAssetContentType(\Magento\Framework\View\Asset\AssetInterface $asset)
renderAssets($resultGroups=[])
renderElementAttributes($elementType)
addDefaultAttributes($contentType, $attributes)
processMerge($groupAssets, $group)
if(!isset($_GET['name'])) $name