Project

General

Profile

Feature #88921

Updated by Josef Glatz about 4 years ago

h2. what 

 
 this event can be triggered to enrich content into any column in the BackendLayout. This content will be shown after the last content element. You can use business logics to show content in specific columns. e.g. for displaying content only in columns without any colpos. 

 h2. why 

 
 i needed that to display records from another table in a column with no colpos. the editor is able to see records in exact that place, where the content is shown in the website. 

 h2. usage 

 h3. register the service in the Services.yaml file 

 <pre><code class="yaml"> 
   # Register an Event for adding Content into BackendLayout Columns 
   YOUR\NameSpace\Backend\View\PageLayoutViewDrawEmptyColposContent: 
     tags: 
       - { name: event.listener, 
           identifier: 'emptyColposListener', 
           event:    TYPO3\CMS\Backend\View\Event\AfterGeneratedColposMarkupEvent } 
 </code></pre> 

 h3. add your own service class 

 you can use in your own class as much business logic as you want. e.g. fetch data from a rest service and place it in the colpos of your needs. 

 <pre><code class="php"> 
 class PageLayoutViewDrawEmptyColposContent 
 { 
     public function __invoke(AfterGeneratedColposMarkupEvent $event): void 
     { 
         if (!isset($event->getColumnConfig()['colPos'])) { 
             $content = <<<EOD 
                 <div data-colpos="1" data-language-uid="0" class="t3-page-ce-wrapper"> 
                     <div class="t3-page-ce"> 
                         <div class="t3-page-ce-header">Empty Colpos</div> 
                         <div class="t3-page-ce-body"> 
                             <div class="t3-page-ce-body-inner"> 
                                 <div class="row"> 
                                     <div class="col-xs-12"> 
                                         This column has no "colPos". This is only for display Purposes. You can now fetch Data from somewhere else and display it right in this position.   
                                     </div> 
                                 </div> 
                             </div> 
                
                             <div class="t3-page-ce-footer"> 
                                 <div class="t3-page-ce-info">KTHXBYE!</div> 
                             </div> 
                         </div> 
                     </div> 
                 </div>       
 EOD; 

             $event->setContent($content); 
         } 
     } 
 } 
 </code></pre> 





Back