Project

General

Profile

Actions

Feature #99323

closed

PSR-14 Event for manipulating records in ContentContentObject.php->render()

Added by Joey Bouten over 1 year ago. Updated 4 months ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Content Rendering
Start date:
2022-12-09
Due date:
% Done:

100%

Estimated time:
PHP Version:
Tags:
PSR-14 Event
Complexity:
easy
Sprint Focus:

Description

Due to our use of `mod.web_layout.allowInconsistentLanguageHandling = 1` we encountered an issue that the sorting of the content elements in the front-end differs from the sorting in the backend.
Since we use strict mode incombination with allowing non-connected content elements in languages the sortings fails since it is always based on the sorting of the default language.

We fixed this in V10 by introducing a PSR-14 Event with-in a XClass.
Since `allowInconsistentLanguageHandling` is not officially supported by the core we do not expect a bugfix.
That is why we would like to introduce a PSR-14 Event in the render function like this.
So we can use the event to re-sort the elements with an asort.

......
do {
    $records = $this->cObj->getRecords($conf['table'], $conf['select.']);

    // START: THIS WAS CHANGED IN THE XCLASS IN THIS FUNCTION
    $eventDispatcher = GeneralUtility::makeInstance(EventDispatcher::class);
    $event = $eventDispatcher->dispatch(
        new ModifyRecordsAfterFetchingContentEvent($records, $conf)
    );
    $records = $event->getRecords();
    // END: THIS WAS CHANGED IN THE XCLASS IN THIS FUNCTION

    $cobjValue = '';
    if (!empty($records)) {
        $this->getTimeTracker()->setTSlogMessage('NUMROWS: ' . count($records));
......

I will provide a PR in the following days.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Task #102850: Fix FQCN in changelog for ModifyRecordsAfterFetchingContentEventClosedChris Müller2024-01-17

Actions
Actions

Also available in: Atom PDF