Skip to content

Commit b5f4e07

Browse files
committed
add in purge directives
1 parent f936f77 commit b5f4e07

4 files changed

Lines changed: 49 additions & 1 deletion

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ProxiBlue\HyvaQtyInput\Observer;
6+
7+
use Magento\Framework\Component\ComponentRegistrar;
8+
use Magento\Framework\Event\Observer;
9+
use Magento\Framework\Event\ObserverInterface;
10+
11+
class RegisterModuleForHyvaConfig implements ObserverInterface
12+
{
13+
private $componentRegistrar;
14+
15+
public function __construct(ComponentRegistrar $componentRegistrar)
16+
{
17+
$this->componentRegistrar = $componentRegistrar;
18+
}
19+
20+
public function execute(Observer $event)
21+
{
22+
$config = $event->getData('config');
23+
$extensions = $config->hasData('extensions') ? $config->getData('extensions') : [];
24+
25+
$moduleName = implode('_', array_slice(explode('\\', __CLASS__), 0, 2));
26+
27+
$path = $this->componentRegistrar->getPath(ComponentRegistrar::MODULE, $moduleName);
28+
29+
// Only use the path relative to the Magento base dir
30+
$extensions[] = ['src' => substr($path, strlen(BP) + 1)];
31+
32+
$config->setData('extensions', $extensions);
33+
}
34+
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "proxi-blue/hyva-qtyinput",
3-
"version": "1.0.5",
3+
"version": "1.0.6",
44
"description": "Enhance QTY input to honour min/max and increment values",
55
"type": "magento2-module",
66
"require": {

etc/frontend/events.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd"
3+
>
4+
<event name="hyva_config_generate_before">
5+
<observer name="proxiblue-qtyinput" instance="ProxiBlue\HyvaQtyInput\Observer\RegisterModuleForHyvaConfig"/>
6+
</event>
7+
</config>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
purge: {
3+
content: [
4+
'../templates/**/*.phtml',
5+
]
6+
}
7+
}

0 commit comments

Comments
 (0)