/** * @see \cms\system\content\type\IContentType::getOutput() */ public function getOutput(Content $content) { $childIDs = ContentCache::getInstance()->getChildIDs($content->contentID); $children = array(); foreach ($childIDs as $childID) { $children[] = ContentCache::getInstance()->getContent($childID); } WCF::getTPL()->assign(array('children' => $children)); return parent::getOutput($content); }
/** * @see \wcf\form\IForm::validate() */ public function validate() { parent::validate(); // validate position if (!in_array($this->position, array('body', 'sidebar'))) { throw new UserInputException('position'); } if ($this->position == 'sidebar' && !$this->objectType->allowsidebar) { throw new UserInputException('position'); } if ($this->position == 'body' && !$this->objectType->allowcontent) { throw new UserInputException('position'); } // validate show order if ($this->showOrder == 0) { $childIDs = ContentCache::getInstance()->getChildIDs($this->parentID ?: null); if (!empty($childIDs)) { $showOrders = array(); foreach ($childIDs as $childID) { $content = ContentCache::getInstance()->getContent($childID); $showOrders[] = $content->showOrder; } array_unique($showOrders); if (isset($this->contentID)) { $content = ContentCache::getInstance()->getContent($this->contentID); if ($content->showOrder == max($showOrders) && max($showOrders) != 0) { $this->showOrder = max($showOrders); } else { $this->showOrder = intval(max($showOrders) + 1); } } else { $this->showOrder = intval(max($showOrders) + 1); } } else { $this->showOrder = 1; } } if (!I18nHandler::getInstance()->validateValue('title')) { if (I18nHandler::getInstance()->isPlainValue('title')) { throw new UserInputException('title'); } else { throw new UserInputException('title', 'multilingual'); } } $page = new Page($this->pageID); if (!$page->pageID) { throw new UserInputException('pageID', 'invalid'); } // validate object type specific parameters $this->objectType->getProcessor()->validate($this->contentData); }
/** * Returns the parent content object or null if no parent content * exists. * * @return \cms\data\content\Content */ public function getParentContent() { if ($this->parentID !== null) { return ContentCache::getInstance()->getContent($this->parentID); } return null; }
protected function getContent($contentID) { return ContentCache::getInstance()->getContent($contentID); }