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