Merge branch '3.0'
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / system / category / ICategoryType.class.php
1 <?php
2 namespace wcf\system\category;
3 use wcf\data\category\CategoryEditor;
4
5 /**
6 * Every category type has to implement this interface.
7 *
8 * @author Matthias Schmidt
9 * @copyright 2001-2018 WoltLab GmbH
10 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
11 * @package WoltLabSuite\Core\System\Category
12 */
13 interface ICategoryType {
14 /**
15 * Is called right after the given category is deleted.
16 *
17 * @param CategoryEditor $categoryEditor
18 */
19 public function afterDeletion(CategoryEditor $categoryEditor);
20
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
29 /**
30 * Returns true if the active user can add a category of this type.
31 *
32 * @return boolean
33 */
34 public function canAddCategory();
35
36 /**
37 * Returns true if the active user can delete a category of this type.
38 *
39 * @return boolean
40 */
41 public function canDeleteCategory();
42
43 /**
44 * Returns true if the active user can edit a category of this type.
45 *
46 * @return boolean
47 */
48 public function canEditCategory();
49
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 * ]
64 *
65 * @param array $categoryData
66 */
67 public function changedParentCategories(array $categoryData);
68
69 /**
70 * Returns true if a category of this type may have no empty description.
71 *
72 * @return boolean
73 */
74 public function forceDescription();
75
76 /**
77 * Returns abbreviation of the application this category type belongs to.
78 *
79 * @return string
80 */
81 public function getApplication();
82
83 /**
84 * Returns the name of the object type of the definition with the given
85 * name for categories of this type or `null` if no such object type exists.
86 *
87 * @param string $definitionName
88 * @return string|null
89 */
90 public function getObjectTypeName($definitionName);
91
92 /**
93 * Returns the language variable category for the description language
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 /**
108 * Returns the language variable value with the given name. The given name
109 * may not contain the language category prefix.
110 *
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
118 * @return string
119 */
120 public function getLanguageVariable($name, $optional = false);
121
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
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();
137
138 /**
139 * Returns true if categories of this type have descriptions.
140 *
141 * @return boolean
142 */
143 public function hasDescription();
144 }