Skip to content

Commit 59f7478

Browse files
committed
Improved missing hyva packages detection
1 parent 33f73bd commit 59f7478

File tree

2 files changed

+35
-25
lines changed

2 files changed

+35
-25
lines changed

Block/Adminhtml/HyvaThemeChecker.php

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,24 +49,32 @@ public function __construct(
4949
*/
5050
public function getWitchModuleIsInstalled(): array
5151
{
52-
$modules = [
53-
'Magefan_Blog' => 'https://github.com/magefan/hyva-theme-blog',
54-
'Magefan_BlogPlus' => 'https://github.com/magefan/hyva-theme-blog-plus',
55-
'Magefan_BlogExtra' => 'https://github.com/magefan/hyva-theme-blog-extra',
56-
'Magefan_BlogAuthor' => 'https://github.com/magefan/hyva-theme-blog-author',
57-
'Magefan_AutoRelatedProduc' => 'https://github.com/magefan/hyva-theme-auto-related-product',
58-
'Magefan_AutoRelatedProductPlus' => 'https://github.com/magefan/hyva-theme-auto-related-product-plus',
59-
'Magefan_AutoLanguageSwitcher' => 'https://github.com/magefan/hyva-theme-auto-language-switcher'
52+
$moduleGroups = [
53+
'Blog' => [
54+
'Magefan_BlogExtra' => 'magefan/hyva-theme-blog-extra',
55+
'Magefan_BlogPlus' => 'magefan/hyva-theme-blog-plus',
56+
'Magefan_Blog' => 'magefan/hyva-theme-blog'
57+
],
58+
'AutoRelatedProduc' => [
59+
'Magefan_AutoRelatedProductPlus' => 'magefan/hyva-theme-auto-related-product-plus',
60+
'Magefan_AutoRelatedProduc' => 'magefan/hyva-theme-auto-related-product'
61+
],
62+
'AutoLanguageSwitcher' => [
63+
'Magefan_AutoLanguageSwitcher' => 'magefan/hyva-theme-auto-language-switcher'
64+
]
6065
];
6166

6267
$hyvaModules = [];
63-
foreach ($modules as $module => $url){
64-
if ($this->moduleManager->isEnabled($module)) {
65-
$hyvaModule = 'Hyva_' . str_replace('_', '', $module);
66-
if (!$this->moduleManager->isEnabled($hyvaModule)) {
67-
$hyvaModules[$hyvaModule] = $url;
68-
}
69-
}
68+
foreach ($moduleGroups as $groupKey => $modules) {
69+
foreach ($modules as $module => $packageName) {
70+
if ($this->moduleManager->isEnabled($module)) {
71+
$hyvaModule = 'Hyva_' . str_replace('_', '', $module);
72+
if (!$this->moduleManager->isEnabled($hyvaModule)) {
73+
$hyvaModules[$hyvaModule] = $packageName;
74+
break;
75+
}
76+
}
77+
}
7078
}
7179
return $hyvaModules;
7280
}

view/adminhtml/templates/hyvathemechecker.phtml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,18 @@
1717
<div data-ui-id="messages-message-notice" class="linv">
1818
<?= $block->escapeHtml(__('It looks like you are using the Hyva theme, ' .
1919
'but the Hyva Magefan extensions for Hyva compatibility are not installed. ' .
20-
'Please install these modules for the proper functioning of the blog module on the Hyva theme:')) ?>
21-
<div style="margin-left: 30px">
22-
<br/>
23-
<ul>
24-
<?php foreach ($items as $name => $url) { ?>
25-
<li>
26-
<a href="<?= $block->escapeHtml($url) ?>" target="_blank"><?= $block->escapeHtml($name) ?></a>
27-
</li>
28-
<?php } ?>
29-
</ul>
20+
'Please install these packages for the proper functioning of the modules on the Hyva theme. Run the CLI commands:')) ?>
21+
<div>
22+
<?php
23+
$commands = '';
24+
foreach ($items as $name => $packageName) {
25+
$commands .= 'composer require ' . $block->escapeHtml($packageName) . PHP_EOL;
26+
$commands .= 'bin/magento setup:upgrade' . PHP_EOL;
27+
$commands .= 'bin/magento setup:di:compile' . PHP_EOL;
28+
$commands .= 'bin/magento setup:static-content:deploy' . PHP_EOL;
29+
}
30+
?>
31+
<pre><?= /* @noEscape */ $commands ?>
3032
</div>
3133
</div>
3234
</div>

0 commit comments

Comments
 (0)