File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+
3+ declare (strict_types=1 );
4+
5+ namespace CustomGento \Cookiebot \Plugin \Cms \Model ;
6+
7+ use CustomGento \Cookiebot \Model \Config ;
8+ use CustomGento \Cookiebot \Model \ExternalVideoReplacer ;
9+ use Magento \Cms \Model \Page ;
10+
11+ class AddVideoBlockerToCmsContentPlugin
12+ {
13+ public function __construct (
14+ private readonly Config $ config ,
15+ private readonly ExternalVideoReplacer $ externalVideoReplacer
16+ ) {
17+ }
18+
19+ public function afterGetContent (Page $ subject , string $ result ): string
20+ {
21+ // Only process if the block_videos_until_consent feature is enabled
22+ if (!$ this ->config ->isBlockVideosUntilConsentEnabled ()) {
23+ return $ result ;
24+ }
25+
26+ return $ this ->externalVideoReplacer ->replaceIframeSources ($ result );
27+ }
28+ }
Original file line number Diff line number Diff line change 11<?xml version =" 1.0" ?>
22<config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" urn:magento:framework:ObjectManager/etc/config.xsd" >
33 <type name =" Magento\PageBuilder\Model\Filter\Template" >
4- <plugin name =" customgento_cookiebot_pagebuilder_template_video_blocker_plugin" type =" CustomGento\Cookiebot\Plugin\PageBuilder\Model\Filter\AddVideoBlockerFilterPlugin" sortOrder =" 10" />
4+ <plugin name =" customgento_cookiebot_pagebuilder_template_video_blocker_plugin" type =" CustomGento\Cookiebot\Plugin\PageBuilder\Model\Filter\AddVideoBlockerToCmsContentPlugin" sortOrder =" 10" />
5+ </type >
6+ <type name =" Magento\Cms\Model\Page" >
7+ <plugin name =" customgento_cookiebot_cms_page_content_video_blocker_plugin" type =" CustomGento\Cookiebot\Plugin\Cms\Model\AddVideoBlockerToCmsContentPlugin" sortOrder =" 10" />
58 </type >
69</config >
You can’t perform that action at this time.
0 commit comments