/** * @return bool */ public function isPageDraft() { return $this->page->isDraft(); }
/** * @param string $formatString * @param Page $page * @return string * @throws \Nette\Application\UI\InvalidLinkException */ private function createLogMessage($formatString, Page $page) { return sprintf($formatString, $this->user->getId(), $this->user->getUsername(), $this->linkGenerator->link('Pages:Front:Page:show', ['internal_id' => $page->getId()]), $page->isDraft() ? ' draft' : '', $page->getId(), $page->getTitle()); }
/** * @param array $values * @param Page $page * @throws PagePublicationTimeException * @throws PageIntroHtmlLengthException */ private function fillPageEntity(array $values, Page $page) { $page->setTitle($values['title']); $page->setMetaDescription($values['description']); $page->setMetaKeywords($values['keywords']); $page->setIntro($values['intro']); $page->setIntroHtml($this->texy->process($values['intro'])); $page->setText($values['text']); if ($values['text'] === null) { $page->setTextHtml(null); } else { $page->setTextHtml($this->texy->process($values['text'])); } $page->setPublishedAt($values['publishedAt']); $page->setAllowedComments($values['allowedComments']); if ($page->isDraft() and $values['saveAsDraft'] === false) { $page->setAsPublished($values['publishedAt']); } }