aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/Dashboard/Model/WidgetButton.php
blob: 1c9ea6266a9dcd5b4e6a2d26da4ab4e7ad0f7787 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php

declare(strict_types=1);
/**
 * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

namespace OCP\Dashboard\Model;

/**
 * Button for a dashboard widget
 *
 * @since 25.0.0
 */
class WidgetButton {
	/**
	 * @since 25.0.0
	 */
	public const TYPE_NEW = 'new';

	/**
	 * @since 25.0.0
	 */
	public const TYPE_MORE = 'more';

	/**
	 * @since 25.0.0
	 */
	public const TYPE_SETUP = 'setup';

	private string $type;
	private string $link;
	private string $text;

	/**
	 * @param string $type
	 * @param string $link
	 * @param string $text
	 * @since 25.0.0
	 */
	public function __construct(string $type, string $link, string $text) {
		$this->type = $type;
		$this->link = $link;
		$this->text = $text;
	}

	/**
	 * Get the button type, either "new", "more" or "setup"
	 *
	 * @return string
	 * @since 25.0.0
	 */
	public function getType(): string {
		return $this->type;
	}

	/**
	 * Get the absolute url the buttons links to
	 *
	 * @return string
	 * @since 25.0.0
	 */
	public function getLink(): string {
		return $this->link;
	}

	/**
	 * Get the translated text for the button
	 *
	 * @return string
	 * @since 25.0.0
	 */
	public function getText(): string {
		return $this->text;
	}
}