aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/Settings/ExampleContentSettings.php
blob: f5607b6a31b0f3c8e0c0644061c9361f1051b3fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php

declare(strict_types=1);

/**
 * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */
namespace OCA\DAV\Settings;

use OCA\DAV\AppInfo\Application;
use OCP\App\IAppManager;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Services\IInitialState;
use OCP\IConfig;
use OCP\Settings\ISettings;

class ExampleContentSettings implements ISettings {

	public function __construct(
		private IConfig $config,
		private IInitialState $initialState,
		private IAppManager $appManager,
	) {
	}

	public function getForm(): TemplateResponse {
		$enableDefaultContact = $this->config->getAppValue(Application::APP_ID, 'enableDefaultContact', 'no');
		$this->initialState->provideInitialState('enableDefaultContact', $enableDefaultContact);
		return new TemplateResponse(Application::APP_ID, 'settings-example-content');
	}
	public function getSection(): ?string {
		if (!$this->appManager->isEnabledForUser('contacts')) {
			return null;
		}

		return 'groupware';
	}

	public function getPriority(): int {
		return 10;
	}

}