-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into magento2.3.x
- Loading branch information
Showing
10 changed files
with
119 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
/** | ||
* Copyright © OpenGento, All rights reserved. | ||
* See LICENSE bundled with this library for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Opengento\Gdpr\Model\View\Page\Config; | ||
|
||
use Magento\Framework\View\Asset\AssetInterface; | ||
use Magento\Framework\View\Asset\GroupedCollection; | ||
use Magento\Framework\View\Asset\PropertyGroup; | ||
use Magento\Framework\View\Page\Config\Renderer as ViewRenderer; | ||
use function file_get_contents; | ||
use function sprintf; | ||
use const PHP_EOL; | ||
|
||
class Renderer extends ViewRenderer | ||
{ | ||
protected function renderAssetHtml(PropertyGroup $group): string | ||
{ | ||
$assets = $this->processMerge($group->getAll(), $group); | ||
$attributes = $this->getGroupAttributes($group); | ||
$result = ''; | ||
|
||
/** @var $asset AssetInterface */ | ||
foreach ($assets as $asset) { | ||
$result .= $this->inlineHtml( | ||
$group->getProperty(GroupedCollection::PROPERTY_CONTENT_TYPE), | ||
$asset->getUrl(), | ||
$this->addDefaultAttributes($this->getAssetContentType($asset), $attributes) | ||
); | ||
} | ||
|
||
return $result; | ||
} | ||
|
||
private function inlineHtml(string $contentType, string $src, ?string $attributes): string | ||
{ | ||
switch ($contentType) { | ||
case 'js': | ||
$result = '<script ' . $attributes . '>' . file_get_contents($src) . '</script>'; | ||
break; | ||
|
||
case 'css': | ||
$result = '<style ' . $attributes . '>' . file_get_contents($src) . '</style>'; | ||
break; | ||
default: | ||
$result = sprintf($this->getAssetTemplate($contentType, $attributes), $src); | ||
break; | ||
} | ||
|
||
return $result . PHP_EOL; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
/** | ||
* Copyright © OpenGento, All rights reserved. | ||
* See LICENSE bundled with this library for license details. | ||
*/ | ||
--> | ||
<page_layouts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/PageLayout/etc/layouts.xsd"> | ||
<layout id="customer_privacy_export"> | ||
<label>Customer Privacy Export Personal Data</label> | ||
</layout> | ||
</page_layouts> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
--> | ||
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd"> | ||
<container name="root"> | ||
<container name="page.wrapper" as="page_wrapper" htmlTag="div" htmlClass="page-wrapper"> | ||
<container name="main.content" htmlTag="main" htmlId="maincontent" htmlClass="page-main"> | ||
<container name="columns.top" label="Before Main Columns"/> | ||
<container name="columns" htmlTag="div" htmlClass="columns"> | ||
<container name="main" label="Main Content Container" htmlTag="div" htmlClass="column main"/> | ||
</container> | ||
</container> | ||
<container name="page.bottom.container" as="page_bottom_container" label="Before Page Footer Container" after="main.content" htmlTag="div" htmlClass="page-bottom"/> | ||
</container> | ||
</container> | ||
</layout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
/** | ||
* Copyright © OpenGento, All rights reserved. | ||
* See LICENSE bundled with this library for license details. | ||
*/ | ||
declare(strict_types=1); | ||
?> | ||
<!doctype html> | ||
<html <?= $htmlAttributes ?? '' ?>> | ||
<head <?= $headAttributes ?? '' ?>> | ||
<?= $headContent ?? '' ?> | ||
</head> | ||
<body data-container="body" <?= $bodyAttributes ?? '' ?>> | ||
<?= $layoutContent ?? '' ?> | ||
</body> | ||
</html> |