diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2024-11-06 08:54:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-06 08:54:40 +0100 |
commit | 8fab143aa486904f7a17c4f1c2f6364cd43bf9d9 (patch) | |
tree | 91381cb6382ea0d1b006ba00c9e4b7d7b418bb97 /lib/public | |
parent | 01ad23aaaa3e18fa30fb6bef85e8bd2cc3c3e054 (diff) | |
parent | bcfb02f5d79796cae2fe45b9b64926eae51680a1 (diff) | |
download | nextcloud-server-8fab143aa486904f7a17c4f1c2f6364cd43bf9d9.tar.gz nextcloud-server-8fab143aa486904f7a17c4f1c2f6364cd43bf9d9.zip |
Merge pull request #48721 from nextcloud/feat/allow-getter-setter-decl-fors
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/Settings/DeclarativeSettingsTypes.php | 6 | ||||
-rw-r--r-- | lib/public/Settings/IDeclarativeSettingsFormWithHandlers.php | 31 |
2 files changed, 34 insertions, 3 deletions
diff --git a/lib/public/Settings/DeclarativeSettingsTypes.php b/lib/public/Settings/DeclarativeSettingsTypes.php index 82444af9b82..7edf0cbdd6e 100644 --- a/lib/public/Settings/DeclarativeSettingsTypes.php +++ b/lib/public/Settings/DeclarativeSettingsTypes.php @@ -32,8 +32,9 @@ final class DeclarativeSettingsTypes { /** * IDeclarativeSettingsForm storage_type which is determines where and how the config value is stored * - * - * For `external` storage_type the app implementing \OCP\Settings\SetDeclarativeSettingsValueEvent and \OCP\Settings\GetDeclarativeSettingsValueEvent events is responsible for storing and retrieving the config value. + * For `external` storage_type the app needs to either implement event listeners for \OCP\Settings\SetDeclarativeSettingsValueEvent + * and \OCP\Settings\GetDeclarativeSettingsValueEvent or the IDeclarativeSettingsForm also needs to implement + * IDeclarativeSettingsFormWithHandlers for storing and retrieving the config value. * * @since 29.0.0 */ @@ -43,7 +44,6 @@ final class DeclarativeSettingsTypes { * IDeclarativeSettingsForm storage_type which is determines where and how the config value is stored * * For `internal` storage_type the config value is stored in default `appconfig` and `preferences` tables. - * For `external` storage_type the app implementing \OCP\Settings\SetDeclarativeSettingsValueEvent and \OCP\Settings\GetDeclarativeSettingsValueEvent events is responsible for storing and retrieving the config value. * * @since 29.0.0 */ diff --git a/lib/public/Settings/IDeclarativeSettingsFormWithHandlers.php b/lib/public/Settings/IDeclarativeSettingsFormWithHandlers.php new file mode 100644 index 00000000000..180df73d995 --- /dev/null +++ b/lib/public/Settings/IDeclarativeSettingsFormWithHandlers.php @@ -0,0 +1,31 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OCP\Settings; + +use OCP\IUser; + +/** + * @since 31.0.0 + */ +interface IDeclarativeSettingsFormWithHandlers extends IDeclarativeSettingsForm { + + /** + * This function is called to get the current value of a specific forms field. + * @since 31.0.0 + */ + public function getValue(string $fieldId, IUser $user): mixed; + + /** + * This function is called when a user updated a form field to persist the setting. + * @since 31.0.0 + */ + public function setValue(string $fieldId, mixed $value, IUser $user): void; + +} |