<?php
namespace wcf\data\category;
use wcf\data\AbstractDatabaseObjectAction;
+ use wcf\data\ICollapsibleContainerAction;
+ use wcf\data\IPositionAction;
+ use wcf\data\IToggleAction;
use wcf\system\category\CategoryHandler;
use wcf\system\exception\PermissionDeniedException;
+use wcf\system\exception\SystemException;
use wcf\system\exception\ValidateActionException;
use wcf\system\user\collapsible\content\UserCollapsibleContentHandler;
use wcf\system\WCF;
}
/**
- * Toggles the collapse status of categories.
+ * @see wcf\data\ICollapsibleContainerAction::toggleContainer()
*/
public function toggleContainer() {
- $objectTypeID = UserCollapsibleContentHandler::getInstance()->getObjectTypeID($this->objects[0]->getCategoryType()->getCollapsibleObjectTypeName());
+ $collapsibleObjectTypeName = $this->objects[0]->getCategoryType()->getObjectTypeName('com.woltlab.wcf.collapsibleContent');
+ if ($collapsibleObjectTypeName === null) {
+ throw new SystemException("Categories of this type don't support collapsing");
+ }
+
+ $objectTypeID = UserCollapsibleContentHandler::getInstance()->getObjectTypeID($collapsibleObjectTypeName);
$collapsedCategories = UserCollapsibleContentHandler::getInstance()->getCollapsedContent($objectTypeID);
$categoryID = $this->objects[0]->categoryID;