Skip to content
This repository has been archived by the owner on Jul 25, 2023. It is now read-only.

Commit

Permalink
Merge pull request #4 from erfanimani/added-magento-2.3-compatibility
Browse files Browse the repository at this point in the history
Added Magento 2.3 compatibility.
  • Loading branch information
Nick authored Feb 6, 2020
2 parents c0e3c10 + edb75f8 commit 921dadc
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
}
},
"require": {
"magento/framework": "^101.0.0",
"magento/framework": "101 - 102",
"psr/log": "~1.0"
},
"authors": [
Expand Down
16 changes: 7 additions & 9 deletions src/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@

class Data extends AbstractHelper
{
protected $_assetSource;
protected $_assetRepository;
protected $assetSource;
protected $assetRepository;

public function __construct(
\Magento\Framework\App\Helper\Context $context,
\Magento\Framework\View\Asset\Source $assetSource,
\Magento\Framework\View\Asset\Repository $assetRepository
)
{
$this->_assetSource = $assetSource;
$this->_assetRepository = $assetRepository;
) {
$this->assetSource = $assetSource;
$this->assetRepository = $assetRepository;

parent::__construct($context);
}
Expand All @@ -28,8 +27,7 @@ public function __construct(
*/
public function getViewSvg($path)
{
$file = $this->_assetRepository->createAsset($path);
return $this->_assetSource->getContent($file);
$file = $this->assetRepository->createAsset($path);
return $this->assetSource->getContent($file);
}

}
9 changes: 4 additions & 5 deletions src/Plugin/BlockPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@

class BlockPlugin
{
protected $_svgHelper;
protected $svgHelper;

public function __construct(
\Meanbee\SVGHelper\Helper\Data $svgHelper
)
{
$this->_svgHelper = $svgHelper;
) {
$this->svgHelper = $svgHelper;
}

public function afterCreateBlock($subject, $result)
{
return $result->setData('svgHelper', $this->_svgHelper);
return $result->setData('svgHelper', $this->svgHelper);
}
}
2 changes: 2 additions & 0 deletions src/etc/frontend/di.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<config>
<type name="Magento\Framework\View\Element\BlockFactory">
<plugin name="set_svg_helper" type="Meanbee\SVGHelper\Plugin\BlockPlugin" sortOrder="1" />
Expand Down
2 changes: 1 addition & 1 deletion src/registration.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
\Magento\Framework\Component\ComponentRegistrar::MODULE,
'Meanbee_SVGHelper',
__DIR__
);
);

0 comments on commit 921dadc

Please sign in to comment.