Actions
Feature #88921
closedNew Event in the PageLayoutView Class to enrich Content into the Columns in the BackendLayout
Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Backend API
Target version:
-
Start date:
2019-08-05
Due date:
% Done:
100%
Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:
Description
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.
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.
usage¶
register the service in the Services.yaml file¶
# 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 }
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.
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);
}
}
}
Actions