Skip to content

Commit 17ded70

Browse files
OCA\Passman\Settings: add AdminSection
Also rename the section from 'additional' to 'passman'. Signed-off-by: Raymond Hackley <raymondhackley@protonmail.com>
1 parent 48855ca commit 17ded70

4 files changed

Lines changed: 61 additions & 2 deletions

File tree

appinfo/info.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,6 @@ For an demo of this app visit [https://demo.passman.cc](https://demo.passman.cc)
6565

6666
<settings>
6767
<admin>OCA\Passman\Settings\Admin</admin>
68+
<admin-section>OCA\Passman\Settings\AdminSection</admin-section>
6869
</settings>
6970
</info>

lib/Controller/SettingsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function getForm() {
4646
* @return string the section ID, e.g. 'sharing'
4747
*/
4848
public function getSection() {
49-
return 'additional';
49+
return 'passman';
5050
}
5151

5252
/**

lib/Settings/Admin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function getForm(): TemplateResponse {
9595
* @return string
9696
*/
9797
public function getSection(): string {
98-
return 'additional';
98+
return 'passman';
9999
}
100100

101101
/**

lib/Settings/AdminSection.php

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
3+
/**
4+
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
5+
* SPDX-License-Identifier: AGPL-3.0-or-later
6+
*/
7+
namespace OCA\Passman\Settings;
8+
9+
use OCP\IL10N;
10+
use OCP\IURLGenerator;
11+
use OCP\Settings\IIconSection;
12+
13+
class AdminSection implements IIconSection {
14+
public function __construct(
15+
private string $appName,
16+
private IURLGenerator $url,
17+
private IL10N $l,
18+
) {
19+
}
20+
21+
/**
22+
* returns the ID of the section. It is supposed to be a lower case string,
23+
* e.g. 'ldap'
24+
*
25+
* @returns string
26+
*/
27+
public function getID() {
28+
return $this->appName;
29+
}
30+
31+
/**
32+
* returns the translated name as it should be displayed, e.g. 'LDAP / AD
33+
* integration'. Use the L10N service to translate it.
34+
*
35+
* @return string
36+
*/
37+
public function getName() {
38+
return $this->l->t('Passman');
39+
}
40+
41+
/**
42+
* @return int whether the form should be rather on the top or bottom of
43+
* the settings navigation. The sections are arranged in ascending order of
44+
* the priority values. It is required to return a value between 0 and 99.
45+
*
46+
* E.g.: 70
47+
*/
48+
public function getPriority() {
49+
return 70;
50+
}
51+
52+
/**
53+
* {@inheritdoc}
54+
*/
55+
public function getIcon() {
56+
return $this->url->imagePath($this->appName, 'app-dark.svg');
57+
}
58+
}

0 commit comments

Comments
 (0)