Review main Merged

87058[FEATURE] Allow modifying fetched page content

Oli Bartsch CR +2 V +2 Normal +143 −13 updated 11/20/24, 18:55

Commit message

With #103894, the `PageContentFetchingProcessor` was introduced.
It allows to easily fetch and provide page content based on
the selected page layout in fluid templates.

While this makes the configuration effort a lot easier
for the most common use cases, it fails to provide
any possibility for custom adjustments.

For example, EXT:content_block needs to provide
an additional condition to the select configuration,
to hide "inline content elements" [2].

Since this is not directly possible when using the
`PageContentFetchingProcessor` [1], the new PSR-14
AfterContentHasBeenFetchedEvent is introduced as
an exceptional feature. The event therefore allows
to modify the fetched page content.

Therefore, instead of using user functions
to manipulate SQL statements, e.g.

page.20 = CONTENT
page.20 {
    table = tt_content
    select {
        orderBy = sorting
        where = colPos=0
        where.postUserFunc = TYPO3\CMS\ContentBlocks\UserFunction\ContentWhere->extend
    }
}

one can now use the event to post
process the fetched content:

public function __invoke(AfterContentHasBeenFetchedEvent $event): void
{
    foreach ($event->groupedContent['main']['records'] as $key => $record) {
        if ($record->has('parent_field_name') && (int)($record->get('parent_field_name') ?? 0) > 0) {
            unset($event->groupedContent['main']['records'][$key]);
        }
    }
}

[1] https://github.com/FriendsOfTYPO3/content-blocks/issues/273
[2] https://docs.typo3.org/p/friendsoftypo3/content-blocks/main/en-us/API/NestedContentElements/Index.html#preventing-output-in-frontend

Review

  • Code review CR +2 Done
    • Oli Bartsch +2
    • Garvin Hicking +1
    • Nikita Hovratov +1
    • Benni Mack +1
  • Verified V +2 Done
    • Oli Bartsch +2
    • Nikita Hovratov +1
    • Benni Mack +1
    • core-ci +1 CI

Issues 2

Files 5

Review log 2737

Show 812 earlier messages
  1. Oli Bartsch uploaded patch set 1 11/19/24, 14:54

  2. Oli Bartsch uploaded patch set 2 11/19/24, 14:56

  3. core-ci voted on patch set 2 V +1 11/19/24, 15:07 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69717

  4. core-ci voted on patch set 1 V -1 11/19/24, 15:08 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69715

  5. Oli Bartsch uploaded patch set 3 V +1 11/19/24, 20:15

  6. core-ci voted on patch set 3 V +1 11/19/24, 20:22 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69749

  7. Oli Bartsch uploaded patch set 4 V +1 11/19/24, 20:26

  8. core-ci voted on patch set 4 V +1 11/19/24, 20:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69751

  9. Nikita Hovratov commented on patch set 4 CR +1 V +1 11/19/24, 21:58

  10. Garvin Hicking commented on patch set 4 11/20/24, 07:35

    Feature-105638-ModifySelectConfigurationForFetchingContent.rst:43

    We can use an external :ref: here instead, if Nikkita could maybe add a uniqe heading anchor in the docs? I can make a PR there and if its rendered in main we can directly use it here? That would make it portable for future updates to the manual.

    Feature-105638-ModifySelectConfigurationForFetchingContent.rst:48

    maybe "member properties of the event object" or so, to be more specific and prevent the "information" plural issue ;)

    Feature-105638-ModifySelectConfigurationForFetchingContent.rst:53

    The last two items are missing a ":" for uniformity

    Feature-105638-ModifySelectConfigurationForFetchingContent.rst:75

    We can add a caption here for a filename example

    Feature-105638-ModifySelectConfigurationForFetchingContent.rst:84

    Linebreak for preventing scrollbars here
  11. Garvin Hicking commented on patch set 4 11/20/24, 07:40

    Feature-105638-ModifySelectConfigurationForFetchingContent.rst:43 Reply

  12. Garvin Hicking commented on patch set 5 CR +1 V +1 11/20/24, 08:14

    Published edit on patch set 4.
  1. core-ci voted on patch set 5 V +1 11/20/24, 08:20 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69770

  2. Garvin Hicking commented on patch set 6 V +1 11/20/24, 08:23

    Published edit on patch set 5.
  3. Garvin Hicking commented on patch set 6 11/20/24, 08:23

    Feature-105638-ModifySelectConfigurationForFetchingContent.rst:43 Reply

    Done

    Feature-105638-ModifySelectConfigurationForFetchingContent.rst:48 Reply

    Done

    Feature-105638-ModifySelectConfigurationForFetchingContent.rst:53 Reply

    Done

    Feature-105638-ModifySelectConfigurationForFetchingContent.rst:75 Reply

    Done

    Feature-105638-ModifySelectConfigurationForFetchingContent.rst:84 Reply

    Done
  4. core-ci voted on patch set 6 V +1 11/20/24, 08:30 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69771

  5. Garvin Hicking voted on patch set 6 CR +1 11/20/24, 08:37

  6. Nikita Hovratov voted on patch set 6 CR +1 V +1 11/20/24, 08:39

  7. Oli Bartsch commented on patch set 6 CR -1 11/20/24, 08:41

    Need to change one detail
  8. Oli Bartsch uploaded patch set 7 CR +1 V +1 11/20/24, 08:43

  9. Oli Bartsch commented on patch set 7 11/20/24, 08:43

    Reply

    Done
  10. core-ci voted on patch set 7 V +1 11/20/24, 08:49 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69774

  11. Nikita Hovratov voted on patch set 7 CR +1 V +1 11/20/24, 08:54

  12. Garvin Hicking voted on patch set 7 CR +1 11/20/24, 08:56

  13. Oli Bartsch commented on patch set 7 V -1 11/20/24, 10:11

    Will rework ;)
  14. Oli Bartsch uploaded patch set 8 CR +1 V +1 11/20/24, 11:40

  15. core-ci voted on patch set 8 V -1 11/20/24, 11:46 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69784

  16. Oli Bartsch uploaded patch set 9 V -1 11/20/24, 11:48

  17. core-ci voted on patch set 9 V +1 11/20/24, 11:55 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69785

  18. Oli Bartsch commented on patch set 9 11/20/24, 11:58

    Reply

    Done
  19. Nikita Hovratov uploaded patch set 10 V +1 11/20/24, 12:16

  20. Nikita Hovratov voted on patch set 10 CR +1 V +1 11/20/24, 12:17

  21. core-ci voted on patch set 10 V +1 11/20/24, 12:23 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/69789

  22. Benni Mack voted on patch set 10 CR +1 V +1 11/20/24, 17:31

  23. Garvin Hicking voted on patch set 10 CR +1 11/20/24, 17:41

  24. Oli Bartsch voted on patch set 10 CR +2 V +2 11/20/24, 18:55

  25. Oli Bartsch merged patch set 11 11/20/24, 18:55