aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/indexController.php
diff options
context:
space:
mode:
authorGravatar Stefan <11146296+tryallthethings@users.noreply.github.com> 2025-06-22 00:36:32 +0200
committerGravatar GitHub <noreply@github.com> 2025-06-22 00:36:32 +0200
commit51298cd6bc100b1cc6508abb602a59c01a9e2c04 (patch)
treedc3ac061d48242ddb1dd4aaada009f531e2e08a7 /app/Controllers/indexController.php
parentbea9ca12adf58896a95959c4a1fbb48f4bbc144b (diff)
Exposed the reading modes for extensions through Minz (#7668)
* + Exposed the reading modes for extensions through Minz. Now extensions can add a custom view mode. Graceful fallback to normal view in case the extension was disabled without resetting the view_mode through the uninstall method. In that case the user will be informed via Minz_Request::setBadNotification that the view has been reset to normal. + Added translation strings for de, en and en-us for the notification * + Added missing, generated translations * Simplify indexAction, performance * Minor settings htmlspecialchars * i18n: fr * Minor wording * Doc * Fix i18n --------- Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Diffstat (limited to 'app/Controllers/indexController.php')
-rw-r--r--app/Controllers/indexController.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php
index 661e8300b..d5d9db778 100644
--- a/app/Controllers/indexController.php
+++ b/app/Controllers/indexController.php
@@ -16,9 +16,17 @@ class FreshRSS_index_Controller extends FreshRSS_ActionController {
*/
public function indexAction(): void {
$preferred_output = FreshRSS_Context::userConf()->view_mode;
+ $viewMode = FreshRSS_ViewMode::getAllModes()[$preferred_output] ?? null;
+
+ // Fallback to 'normal' if the preferred mode was not found
+ if ($viewMode === null) {
+ Minz_Request::setBadNotification(_t('feedback.extensions.invalid_view_mode', $preferred_output));
+ $viewMode = FreshRSS_ViewMode::getAllModes()['normal'];
+ }
+
Minz_Request::forward([
- 'c' => 'index',
- 'a' => $preferred_output,
+ 'c' => $viewMode->controller(),
+ 'a' => $viewMode->action(),
]);
}