From 046d5451b15d46581cde846676e0b6d631fedbb7 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Wed, 24 Nov 2021 14:08:16 +0100 Subject: Improve accessibility of the title of the settings Before every setting page had the same title and this is causing issues for screenreaders since they can't differenciate the title of page. Now a new variable is available for apps to declare the page subtitle. This new variable is implemented for the settings app and while at it I added a bit more type hinting to the stuff I touched :) Signed-off-by: Carl Schwan --- lib/private/Settings/Manager.php | 7 +++++++ lib/public/Settings/IIconSection.php | 4 ++-- lib/public/Settings/IManager.php | 6 ++++++ 3 files changed, 15 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php index 84fbf9426b0..ed331c59725 100644 --- a/lib/private/Settings/Manager.php +++ b/lib/private/Settings/Manager.php @@ -145,6 +145,13 @@ class Manager implements IManager { return $this->sections[$type]; } + public function getSection(string $type, string $sectionId): ?IIconSection { + if (isset($this->sections[$type]) && isset($this->sections[$type][$sectionId])) { + return $this->sections[$type][$sectionId]; + } + return null; + } + protected function isKnownDuplicateSectionId(string $sectionID): bool { return in_array($sectionID, [ 'connected-accounts', diff --git a/lib/public/Settings/IIconSection.php b/lib/public/Settings/IIconSection.php index c56565fbf85..bb9b2e94b0d 100644 --- a/lib/public/Settings/IIconSection.php +++ b/lib/public/Settings/IIconSection.php @@ -31,7 +31,7 @@ interface IIconSection { * returns the ID of the section. It is supposed to be a lower case string, * e.g. 'ldap' * - * @returns string + * @return string * @since 9.1 */ public function getID(); @@ -59,7 +59,7 @@ interface IIconSection { * returns the relative path to an 16*16 icon describing the section. * e.g. '/core/img/places/files.svg' * - * @returns string + * @return string * @since 12 */ public function getIcon(); diff --git a/lib/public/Settings/IManager.php b/lib/public/Settings/IManager.php index 2ec3fb0fd21..10de596dbea 100644 --- a/lib/public/Settings/IManager.php +++ b/lib/public/Settings/IManager.php @@ -116,4 +116,10 @@ interface IManager { * @since 13.0.0 */ public function getPersonalSettings($section): array; + + /** + * Get a specific section by type and id + * @since 25.0.0 + */ + public function getSection(string $type, string $sectionId): ?IIconSection; } -- cgit v1.2.3