Commit | Line | Data |
---|---|---|
13d8b49b MS |
1 | <?php |
2 | namespace wcf\system\category; | |
3 | use wcf\data\category\CategoryEditor; | |
4 | ||
5 | /** | |
6 | * Every category type has to implement this interface. | |
a17de04e | 7 | * |
13d8b49b | 8 | * @author Matthias Schmidt |
c839bd49 | 9 | * @copyright 2001-2018 WoltLab GmbH |
13d8b49b | 10 | * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> |
e71525e4 | 11 | * @package WoltLabSuite\Core\System\Category |
13d8b49b MS |
12 | */ |
13 | interface ICategoryType { | |
14 | /** | |
15 | * Is called right after the given category is deleted. | |
16 | * | |
4e25add7 | 17 | * @param CategoryEditor $categoryEditor |
13d8b49b MS |
18 | */ |
19 | public function afterDeletion(CategoryEditor $categoryEditor); | |
20 | ||
095a8b40 JR |
21 | /** |
22 | * Is called before the given category is deleted. | |
23 | * | |
24 | * @param CategoryEditor $categoryEditor | |
25 | * @since 3.1 | |
26 | */ | |
27 | public function beforeDeletion(CategoryEditor $categoryEditor); | |
28 | ||
13d8b49b | 29 | /** |
28410a97 | 30 | * Returns true if the active user can add a category of this type. |
13d8b49b MS |
31 | * |
32 | * @return boolean | |
33 | */ | |
34 | public function canAddCategory(); | |
35 | ||
36 | /** | |
28410a97 | 37 | * Returns true if the active user can delete a category of this type. |
13d8b49b MS |
38 | * |
39 | * @return boolean | |
40 | */ | |
41 | public function canDeleteCategory(); | |
42 | ||
43 | /** | |
28410a97 | 44 | * Returns true if the active user can edit a category of this type. |
13d8b49b MS |
45 | * |
46 | * @return boolean | |
47 | */ | |
48 | public function canEditCategory(); | |
49 | ||
af55e972 MS |
50 | /** |
51 | * Is called after categories were assigned different parent categories. | |
52 | * | |
53 | * Array structure: | |
54 | * [ | |
55 | * categoryID => [ | |
56 | * oldParentCategoryID => 1, | |
57 | * newParentCategoryID => 2 | |
58 | * ], | |
59 | * categoryID => [ | |
60 | * oldParentCategoryID => null, | |
61 | * newParentCategoryID => 2 | |
62 | * ], | |
63 | * ] | |
6f37a5f5 MS |
64 | * |
65 | * @param array $categoryData | |
af55e972 MS |
66 | */ |
67 | public function changedParentCategories(array $categoryData); | |
68 | ||
13d8b49b | 69 | /** |
045f075b | 70 | * Returns true if a category of this type may have no empty description. |
13d8b49b | 71 | * |
045f075b | 72 | * @return boolean |
13d8b49b | 73 | */ |
045f075b | 74 | public function forceDescription(); |
13d8b49b | 75 | |
e9f0a33c MS |
76 | /** |
77 | * Returns abbreviation of the application this category type belongs to. | |
78 | * | |
79 | * @return string | |
80 | */ | |
81 | public function getApplication(); | |
82 | ||
13d8b49b | 83 | /** |
045f075b | 84 | * Returns the name of the object type of the definition with the given |
bea46aa1 | 85 | * name for categories of this type or `null` if no such object type exists. |
13d8b49b | 86 | * |
045f075b | 87 | * @param string $definitionName |
bea46aa1 | 88 | * @return string|null |
13d8b49b | 89 | */ |
045f075b | 90 | public function getObjectTypeName($definitionName); |
13d8b49b MS |
91 | |
92 | /** | |
e3369fd2 | 93 | * Returns the language variable category for the description language |
13d8b49b MS |
94 | * variables of categories of this type. |
95 | * | |
96 | * @return string | |
97 | */ | |
98 | public function getDescriptionLangVarCategory(); | |
99 | ||
100 | /** | |
101 | * Returns the prefix used for language variables of i18n values. | |
102 | * | |
103 | * @return string | |
104 | */ | |
105 | public function getI18nLangVarPrefix(); | |
106 | ||
107 | /** | |
d6556156 MS |
108 | * Returns the language variable value with the given name. The given name |
109 | * may not contain the language category prefix. | |
13d8b49b | 110 | * |
d6556156 MS |
111 | * If "{your.language.category}.list" is wanted, $name has to be "list". |
112 | * If the specific language variable for this category type doesn't exist, | |
113 | * a fallback to the default variables (in this example "wcf.category.list") | |
114 | * is used. | |
115 | * | |
116 | * @param string $name | |
117 | * @param boolean $optional | |
13d8b49b MS |
118 | * @return string |
119 | */ | |
d6556156 | 120 | public function getLanguageVariable($name, $optional = false); |
13d8b49b | 121 | |
045f075b MS |
122 | /** |
123 | * Returns the maximum category nesting level for this type. "-1" means | |
124 | * that there is no maximum. | |
125 | * | |
126 | * @return integer | |
127 | */ | |
128 | public function getMaximumNestingLevel(); | |
129 | ||
13d8b49b MS |
130 | /** |
131 | * Returns the language variable category for the title language variables | |
132 | * of categories of this type. | |
133 | * | |
134 | * @return string | |
135 | */ | |
136 | public function getTitleLangVarCategory(); | |
a833c68b MS |
137 | |
138 | /** | |
045f075b | 139 | * Returns true if categories of this type have descriptions. |
a833c68b MS |
140 | * |
141 | * @return boolean | |
142 | */ | |
045f075b | 143 | public function hasDescription(); |
13d8b49b | 144 | } |