diff --git a/protected/humhub/modules/admin/widgets/InstalledModuleControls.php b/protected/humhub/modules/admin/widgets/InstalledModuleControls.php index 3346d990a7..2e0574fe3d 100644 --- a/protected/humhub/modules/admin/widgets/InstalledModuleControls.php +++ b/protected/humhub/modules/admin/widgets/InstalledModuleControls.php @@ -103,7 +103,7 @@ class InstalledModuleControls extends Menu $this->addEntry(new MenuLink([ 'id' => 'info', 'label' => Yii::t('AdminModule.base', 'Show in Marketplace'), - 'url' => ['/marketplace/browse', 'keyword' => $this->module->id, 'tags' => ''], + 'url' => ['/marketplace/browse', 'id' => $this->module->id], 'icon' => 'info-circle', 'sortOrder' => 600, ])); diff --git a/protected/humhub/modules/marketplace/services/FilterService.php b/protected/humhub/modules/marketplace/services/FilterService.php index c571dbdc91..265a221aea 100644 --- a/protected/humhub/modules/marketplace/services/FilterService.php +++ b/protected/humhub/modules/marketplace/services/FilterService.php @@ -17,6 +17,7 @@ use Yii; class FilterService { private Module $module; + private string $moduleId; private int $categoryId; private array $tags; @@ -24,6 +25,8 @@ class FilterService { $this->module = $module; + $this->moduleId = $moduleId ?? Yii::$app->request->get('id', ''); + $this->categoryId = $categoryId ?? Yii::$app->request->get('categoryId', 0); if (is_array($tags)) { @@ -36,7 +39,25 @@ class FilterService public function isFiltered(): bool { - return $this->isFilteredByCategory() && $this->isFilteredByTags(); + return $this->isFilteredById() && + $this->isFilteredByCategory() && + $this->isFilteredByTags(); + } + + public function isFilteredById(): bool + { + if (empty($this->moduleId)) { + // All modules + return true; + } + + if ($this->moduleId === $this->module->id) { + // Force tags to "All" on filter by module ID + $this->tags = []; + return true; + } + + return false; } public function isFilteredByCategory(): bool diff --git a/protected/humhub/modules/marketplace/widgets/ModuleFilters.php b/protected/humhub/modules/marketplace/widgets/ModuleFilters.php index a37b66d06c..a6d4a20add 100644 --- a/protected/humhub/modules/marketplace/widgets/ModuleFilters.php +++ b/protected/humhub/modules/marketplace/widgets/ModuleFilters.php @@ -82,7 +82,7 @@ class ModuleFilters extends DirectoryFilters { switch ($filter) { case 'tags': - return 'uninstalled'; + return self::isFilteredById() ? '' : 'uninstalled'; } return parent::getDefaultValue($filter); @@ -129,4 +129,9 @@ class ModuleFilters extends DirectoryFilters return $this->render('module-update-info', $info); } + public static function isFilteredById(): bool + { + return Yii::$app->request->get('id', '') !== ''; + } + }