Skip to content

Commit cad2e4d

Browse files
Merge pull request #35309 from nextcloud/fix/fix-33856-Help_pages_Window_title_must_change_when_switching_sidebar_sections
Help pages: set window title for sidebar sections
2 parents 5bf96ee + 3559334 commit cad2e4d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

apps/settings/lib/Controller/HelpController.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
use OCP\AppFramework\Http\ContentSecurityPolicy;
3434
use OCP\AppFramework\Http\TemplateResponse;
3535
use OCP\IGroupManager;
36+
use OCP\IL10N;
3637
use OCP\INavigationManager;
3738
use OCP\IRequest;
3839
use OCP\IURLGenerator;
@@ -45,6 +46,8 @@ class HelpController extends Controller {
4546
private $urlGenerator;
4647
/** @var IGroupManager */
4748
private $groupManager;
49+
/** @var IL10N */
50+
private $l10n;
4851

4952
/** @var string */
5053
private $userId;
@@ -55,13 +58,15 @@ public function __construct(
5558
INavigationManager $navigationManager,
5659
IURLGenerator $urlGenerator,
5760
?string $userId,
58-
IGroupManager $groupManager
61+
IGroupManager $groupManager,
62+
IL10N $l10n
5963
) {
6064
parent::__construct($appName, $request);
6165
$this->navigationManager = $navigationManager;
6266
$this->urlGenerator = $urlGenerator;
6367
$this->userId = $userId;
6468
$this->groupManager = $groupManager;
69+
$this->l10n = $l10n;
6570
}
6671

6772
/**
@@ -73,8 +78,9 @@ public function __construct(
7378
*/
7479
public function help(string $mode = 'user'): TemplateResponse {
7580
$this->navigationManager->setActiveEntry('help');
76-
81+
$pageTitle = $this->l10n->t('Administrator documentation');
7782
if ($mode !== 'admin') {
83+
$pageTitle = $this->l10n->t('User documentation');
7884
$mode = 'user';
7985
}
8086

@@ -91,6 +97,7 @@ public function help(string $mode = 'user'): TemplateResponse {
9197
'urlUserDocs' => $urlUserDocs,
9298
'urlAdminDocs' => $urlAdminDocs,
9399
'mode' => $mode,
100+
'pageTitle' => $pageTitle,
94101
]);
95102
$policy = new ContentSecurityPolicy();
96103
$policy->addAllowedFrameDomain('\'self\'');

0 commit comments

Comments
 (0)