/** * Creates a new post that quotes an already existing post. * * @param Post $quotedPost The post that is to be quoted. The post text of this post will be wrapped in [quote] bb codes. * * @return Post The new post. */ public function createPostWithQuote(Post $quotedPost) { /** @var $post Post */ $post = $this->getClassInstance(); $post->setText('[quote=' . $quotedPost->getUid() . ']' . $quotedPost->getText() . '[/quote]'); return $post; }
/** * Check if $value is valid. If it is not valid, needs to add an error * to Result. * * @param \Mittwald\Typo3Forum\Domain\Model\Forum\Post $post * @return bool */ protected function isValid($post) { $result = TRUE; if (trim($post->getText()) === '') { $this->addError('The post can\'t be empty!.', 1221560718); $result = FALSE; } return $result; }
/** * * Renders the input text. * * @param string $configuration The configuration path * @param \Mittwald\Typo3Forum\Domain\Model\Forum\Post $post * @param string $content The content to be rendered. If NULL, the node * content will be rendered instead. * @return string The rendered text * */ public function render($configuration = 'plugin.tx_typo3forum.settings.textParsing', \Mittwald\Typo3Forum\Domain\Model\Forum\Post $post = NULL, $content = NULL) { $this->textParserService->setControllerContext($this->controllerContext); $this->textParserService->loadConfiguration($configuration); if ($post !== NULL) { #if(!$post->_getProperty('renderedText')) { $renderedText = $this->textParserService->parseText($post->getText()); # $post->_setProperty('renderedText', $renderedText); # $this->postRepository->update($post); #} else $renderedText = $post->_getProperty('renderedText'); } else { $renderedText = $this->textParserService->parseText($content ? $content : trim($this->renderChildren())); } return $renderedText; }