fix module help list

This commit is contained in:
Dennis Eichhorn 2020-02-12 19:14:04 +01:00
parent cc4af64386
commit 1628ee35bd
2 changed files with 7 additions and 6 deletions

View File

@ -126,6 +126,8 @@ final class BackendController extends Controller
$view = new View($this->app->l11nManager, $request, $response); $view = new View($this->app->l11nManager, $request, $response);
$view->setTemplate('/Modules/Help/Theme/Backend/help-module-list'); $view->setTemplate('/Modules/Help/Theme/Backend/help-module-list');
$view->setData('modules', $this->app->moduleManager->getInstalledModules());
return $view; return $view;
} }

View File

@ -12,12 +12,11 @@
*/ */
declare(strict_types=1); declare(strict_types=1);
/** /**
* @var \phpOMS\Views\View $this * @var \phpOMS\Views\View $this
* @var \phpOMS\Module\InfoManager[] $modules
*/ */
$modules = $this->getData('modules');
$modules = $this->app->moduleManager->getInstalledModules();
?> ?>
<div class="row"> <div class="row">
@ -35,18 +34,18 @@ $modules = $this->app->moduleManager->getInstalledModules();
<?php <?php
$count = 0; $count = 0;
foreach ($modules as $key => $module) : foreach ($modules as $key => $module) :
if ((\realpath(__DIR__ . '/../../../' . $module['directory'] . '/Docs/Help/en/SUMMARY.md')) === false) { if ((\realpath(__DIR__ . '/../../../' . $module->getDirectory() . '/Docs/Help/en/SUMMARY.md')) === false) {
continue; continue;
} }
++$count; ++$count;
$url = \phpOMS\Uri\UriFactory::build( $url = \phpOMS\Uri\UriFactory::build(
'{/lang}/backend/help/module/single?id={$module}', '{/lang}/backend/help/module/single?id={$module}',
['$module' => $module['name']['internal']] ['$module' => $module->getInternalName()]
); );
?> ?>
<tr data-href="<?= $url; ?>"> <tr data-href="<?= $url; ?>">
<td data-label="<?= $this->getHtml('Name') ?>"><a href="<?= $url; ?>"><?= $this->printHtml($module['name']['external']); ?></a> <td data-label="<?= $this->getHtml('Name') ?>"><a href="<?= $url; ?>"><?= $this->printHtml($module->getExternalName()); ?></a>
<?php endforeach; ?> <?php endforeach; ?>
<?php if ($count === 0) : ?> <?php if ($count === 0) : ?>
<tr><td class="empty"><?= $this->getHtml('Empty', '0', '0'); ?> <tr><td class="empty"><?= $this->getHtml('Empty', '0', '0'); ?>