return LabelHandler::getInstance()->getLabelGroups(array_unique($groupIDs), true, $permission);
}
+ /**
+ * Returns the label groups for this category.
+ *
+ * @param string $permission
+ * @return ViewableLabelGroup[]
+ * @since 5.4
+ */
+ public function getLabelGroups(string $permission = 'canSetLabel'): array {
+ $labelGroupsToCategories = ArticleCategoryLabelCacheBuilder::getInstance()->getData();
+
+ if (isset($labelGroupsToCategories[$this->categoryID])) {
+ return LabelHandler::getInstance()->getLabelGroups($labelGroupsToCategories[$this->categoryID], true, $permission);
+ }
+
+ return [];
+ }
+
/**
* Returns true if the active user has subscribed to this category.
*
if (!empty($_REQUEST['showArticleAddDialog'])) $this->showArticleAddDialog = 1;
// read available label groups
- $this->labelGroups = ArticleCategory::getAccessibleLabelGroups('canViewLabel');
+ $this->labelGroups = $this->getLabelGroups();
if (!empty($this->labelGroups) && isset($_REQUEST['labelIDs']) && is_array($_REQUEST['labelIDs'])) {
$this->labelIDs = $_REQUEST['labelIDs'];
$this->canonicalURL = LinkHandler::getInstance()->getLink('ArticleList', $this->controllerParameters, ($this->pageNo > 1 ? 'pageNo=' . $this->pageNo : ''));
}
+ /**
+ * Returns the label groups shown on this page.
+ *
+ * @return ViewableLabelGroup[]
+ * @since 5.4
+ */
+ protected function getLabelGroups(): array {
+ return ArticleCategory::getAccessibleLabelGroups('canViewLabel');
+ }
+
/**
* @inheritDoc
*/
namespace wcf\page;
use wcf\data\article\category\ArticleCategory;
use wcf\data\article\CategoryArticleList;
+use wcf\data\label\group\ViewableLabelGroup;
use wcf\system\exception\IllegalLinkException;
use wcf\system\exception\PermissionDeniedException;
use wcf\system\page\PageLocationManager;
}
}
+ /**
+ * @inerhitDoc
+ */
+ protected function getLabelGroups(): array {
+ return $this->category->getLabelGroups('canViewLabel');
+ }
+
/**
* @inheritDoc
*/