Skip to content

Commit

Permalink
Merge pull request #23 from AleksandrsKondratjevs/issue-3564
Browse files Browse the repository at this point in the history
Add install script to create manifest on first module setup
  • Loading branch information
carinadues authored Nov 8, 2021
2 parents 43d2822 + 77ca576 commit 2d93765
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/Setup/InstallData.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
namespace ScandiPWA\Customization\Setup;

use Magento\Framework\Setup\InstallDataInterface;
use ScandiPWA\Customization\Controller\AppIcon;
use ScandiPWA\Customization\Controller\Webmanifest as WebmanifestController;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;

class InstallData implements InstallDataInterface
{
/**
* @var WebmanifestController
*/
protected $webmanifestController;

/**
* @var AppIcon
*/
protected $appIcon;

public function __construct(
WebmanifestController $webmanifestController,
AppIcon $appIcon
)
{
$this->webmanifestController = $webmanifestController;
$this->appIcon = $appIcon;
}

public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$data = $this->webmanifestController->load();
$data['icons'] = $this->appIcon->getIconData();
$this->webmanifestController->saveJson($data);
}
}

0 comments on commit 2d93765

Please sign in to comment.