* Creates a list of all active options.
*
* @param string $parentCategoryName
+ * @param array<string> $ignoreCategories
*/
- protected function loadActiveOptions($parentCategoryName) {
+ protected function loadActiveOptions($parentCategoryName, array $ignoreCategories = array()) {
+ // skip ignored categories
+ if (in_array($parentCategoryName, $ignoreCategories)) {
+ return;
+ }
+
if (!isset($this->cachedCategories[$parentCategoryName]) || $this->checkCategory($this->cachedCategories[$parentCategoryName])) {
if (isset($this->cachedOptionToCategories[$parentCategoryName])) {
foreach ($this->cachedOptionToCategories[$parentCategoryName] as $optionName) {
if (isset($this->cachedCategoryStructure[$parentCategoryName])) {
foreach ($this->cachedCategoryStructure[$parentCategoryName] as $categoryName) {
- $this->loadActiveOptions($categoryName);
+ $this->loadActiveOptions($categoryName, $ignoreCategories);
}
}
}
/**
* Sets option values for a certain user.
*
- * @param wcf\data\user\User
+ * @param wcf\data\user\User $user
+ * @param array<string> $ignoreCategories
*/
- public function setUser(User $user) {
+ public function setUser(User $user, array $ignoreCategories) {
$this->optionValues = array();
$this->user = $user;
if (!$this->didInit) {
- $this->loadActiveOptions($this->categoryName);
+ $this->loadActiveOptions($this->categoryName, $ignoreCategories);
$this->didInit = true;
}