Exemplo n.º 1
0
 /**
  * Constructs a new \EssentialDots\ExtbaseHijax\Event\Listener.
  *
  * @param \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer		$cObj	 	An array of parameters
  */
 public function __construct($cObj = null)
 {
     $this->cObj = $cObj;
     $reset = true;
     $this->userObjectType = $this->cObj->getUserObjectType();
     if ($this->cObj && $this->cObj->currentRecord) {
         list($table, $uid) = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(':', $this->cObj->currentRecord);
         if ($table == 'tt_content' && $uid) {
             $this->data = $this->cObj->data;
             list($this->table) = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(':', $this->cObj->currentRecord);
             $reset = false;
         }
     }
     if ($reset) {
         $this->data = $this->cObj && $this->cObj->data ? $this->cObj->data : array();
         $this->table = '';
         $this->cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
         $this->cObj->start($this->data, $this->table);
     }
 }
 /**
  * Renders FlashMessages and flushes the FlashMessage queue
  * Note: This disables the current page cache in order to prevent FlashMessage output
  * from being cached.
  *
  * @see \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController::no_cache
  * @param string $renderMode one of the RENDER_MODE_* constants
  * @return string rendered Flash Messages, if there are any.
  * @api
  */
 public function render($renderMode = self::RENDER_MODE_UL)
 {
     $flashMessages = $this->controllerContext->getFlashMessageQueue()->getAllMessagesAndFlush();
     if ($flashMessages === NULL || count($flashMessages) === 0) {
         return '';
     }
     if (isset($GLOBALS['TSFE']) && $this->contentObject->getUserObjectType() === \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::OBJECTTYPE_USER) {
         $GLOBALS['TSFE']->no_cache = 1;
     }
     switch ($renderMode) {
         case self::RENDER_MODE_UL:
             return $this->renderUl($flashMessages);
         case self::RENDER_MODE_DIV:
             return $this->renderDiv($flashMessages);
         default:
             throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception('Invalid render mode "' . $renderMode . '" passed to FlashMessageViewhelper', 1290697924);
     }
 }