Project

General

Profile

Feature #96061

Updated by Georg Ringer 6 months ago

Please define RendererResolver in an static Member    (in Example $rendererResolverClassName) in \TYPO3\CMS\Fluid\ViewHelpers\FlashMessagesViewHelper like Description 

 So is it easier to extend the Viewhelper and change the RendererResolver-Class 

 <pre> 
 class FlashMessagesViewHelper 
 { 

     // New Ststic Member for RendererResolver 
     protected static $rendererResolverClassName = TYPO3\CMS\Core\Messaging\FlashMessageRendererResolver::class; 


    
     public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) 
     { 
         $as = $arguments['as']; 
         $queueIdentifier = $arguments['queueIdentifier'] ?? null; 
         $flashMessages = $renderingContext->getControllerContext() 
             ->getFlashMessageQueue($queueIdentifier)->getAllMessagesAndFlush(); 
         if ($flashMessages === null || count($flashMessages) === 0) { 
             return ''; 
         } 

         if ($as === null) { 
             return GeneralUtility::makeInstance(static::$rendererResolverClassName) 
                 ->resolve() 
                 ->render($flashMessages); 
         } 

         $templateVariableContainer = $renderingContext->getVariableProvider(); 
         $templateVariableContainer->add($as, $flashMessages); 
         $content = $renderChildrenClosure(); 
         $templateVariableContainer->remove($as); 

         return $content; 
     } 

 ..... 
 } 
 </pre> 

 <pre> 
 


 class OwnFlashMessagesViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\FlashMessagesViewHelper 
 { 


     protected static $rendererResolverClassName = OwnFlashMessageRendererResolver::class; 

 } 
 </pre>

Back