Skip to content

Commit

Permalink
Merge pull request #3051 from Smile-SA/feat-pykettk-conditional-track…
Browse files Browse the repository at this point in the history
…ing-blocks

Only Add Frontend Tracker Blocks If Config Enabled
  • Loading branch information
rbayet authored Sep 16, 2023
2 parents 08503fd + 9c002b9 commit 58dca03
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

<body>
<referenceContainer name="before.body.end">
<block class="Smile\ElasticsuiteTracker\Block\Variables\Page\Search" name="smile.tracker.page.search" />
<block class="Smile\ElasticsuiteTracker\Block\Variables\Page\Search"
name="smile.tracker.page.search"
ifconfig="smile_elasticsuite_tracker/general/enabled" />
</referenceContainer>
</body>
</page>
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

<body>
<referenceContainer name="before.body.end">
<block class="Smile\ElasticsuiteTracker\Block\Variables\Page\Order" name="smile.tracker.page.order" />
<block class="Smile\ElasticsuiteTracker\Block\Variables\Page\Order"
name="smile.tracker.page.order"
ifconfig="smile_elasticsuite_tracker/general/enabled" />
</referenceContainer>
</body>
</page>
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="Smile\ElasticsuiteTracker\Block\Variables\Page\Cms" name="smile.tracker.page.cms"/>
<block class="Smile\ElasticsuiteTracker\Block\Variables\Page\Cms"
name="smile.tracker.page.cms"
ifconfig="smile_elasticsuite_tracker/general/enabled" />
</referenceContainer>
</body>
</page>
13 changes: 10 additions & 3 deletions src/module-elasticsuite-tracker/view/frontend/layout/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
</head>
<body>
<referenceBlock name="head.additional">
<block template="Smile_ElasticsuiteTracker::config.phtml" class="Smile\ElasticsuiteTracker\Block\Config" name="smile.tracker.config">
<block template="Smile_ElasticsuiteTracker::config.phtml"
class="Smile\ElasticsuiteTracker\Block\Config"
name="smile.tracker.config"
ifconfig="smile_elasticsuite_tracker/general/enabled">
<arguments>
<argument name="userConsentScript" xsi:type="string">Smile_ElasticsuiteTracker/js/user-consent</argument>
<argument name="userConsentConfig" xsi:type="array">
Expand All @@ -32,8 +35,12 @@
</block>
</referenceBlock>
<referenceContainer name="before.body.end">
<block class="Smile\ElasticsuiteTracker\Block\Variables\Page\Base" name="smile.tracker.page.base" />
<block class="Smile\ElasticsuiteTracker\Block\Variables\Page\Catalog" name="smile.tracker.page.catalog" />
<block class="Smile\ElasticsuiteTracker\Block\Variables\Page\Base"
name="smile.tracker.page.base"
ifconfig="smile_elasticsuite_tracker/general/enabled" />
<block class="Smile\ElasticsuiteTracker\Block\Variables\Page\Catalog"
name="smile.tracker.page.catalog"
ifconfig="smile_elasticsuite_tracker/general/enabled" />
</referenceContainer>
</body>
</page>

0 comments on commit 58dca03

Please sign in to comment.