-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #23 from AleksandrsKondratjevs/issue-3564
Add install script to create manifest on first module setup
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |