Issue Bug Closed

#105865UriBuilder does not respect plugin.tx_myext.view.defaultPid=auto after list_type-to-CType-migration

Daniel Regelein 12/28/24, 01:14 updated 08/12/25, 14:36

Description

After list_type-to-CType-migration (see https://docs.typo3.org/m/typo3/reference-coreapi/main/en-us/ApiOverview/ContentElements/MigrationListType.html), the UriBuilder does not respect plugin.tx_$pluginSignature.view.defaultPid=auto anymore.

This is caused as the ExtensionService used to determine the PageId of the URIs to be generated may have been forgotten to be adapted accordingly.
In method \TYPO3\CMS\Extbase\Service\ExtensionService::getTargetPidByPlugin() , a query is executed to determine the correct Pid of the requested controller. This query only addresses plugins with CType list and and according list_type, and does not include Plugins with an individual CType. Thus it fails to return the correct Pid to the UriBuilder, which then generates URIs pointing to a potentially wrong page.

                $pages = $queryBuilder
                    ->select('pid')
                    ->from('tt_content')
                    ->where(
                        $queryBuilder->expr()->eq(
                            'list_type',
                            $queryBuilder->createNamedParameter($pluginSignature)
                        ),
                        $queryBuilder->expr()->eq(
                            'CType',
                            $queryBuilder->createNamedParameter('list')
                        ),
                        $queryBuilder->expr()->eq(
                            'sys_language_uid',
                            $queryBuilder->createNamedParameter($languageId, Connection::PARAM_INT)
                        )
                    )

This should be changed to also include Plugin CTypes, sth. like:

                    ->where(
                        $queryBuilder->expr()->eq(
                            'CType',
                            $queryBuilder->createNamedParameter($pluginSignature)
                        ),
                        $queryBuilder->expr()->eq(
                            'CType',
                            $queryBuilder->createNamedParameter('list')
                        ),
                    )
                    ->orWhere(
                        $queryBuilder->expr()->eq(
                            'CType',
                            $queryBuilder->createNamedParameter($pluginSignature)
                        )
                    )
                    ->andWhere(
                        $queryBuilder->expr()->eq(
                            'sys_language_uid',
                            $queryBuilder->createNamedParameter($languageId, Connection::PARAM_INT)
                        )
                    )

Reviews 1

History 810

  1. Garvin Hicking commented and changed assigned to Garvin Hicking priority Should have Must have target version <span data-processor="relativetime" data-value="2024-12-28T15:32:56+00:00" > 12/28/24, 15:32 </span>

    Hi Daniel,

    thanks for your report. v13 actually did not perform this CType lookup properly.

    With v14, this was already fixed (with the removal of “list_type”, which is still available in 13.4).

    I’ve created a patch assigned to this ticket which you may be able to try out and verify if it works for you? It would only affect v13 then, not v14. I’ve added a test to ensure this scenario is covered there now.

    Best regards,
    Garvin

  2. Daniel Regelein commented <span data-processor="relativetime" data-value="2024-12-31T14:43:20+00:00" > 12/31/24, 14:43 </span>

    Hi Garvin,

    thank you for getting into this and providing a fix. It now works as intended.

    Happy new year, best regards
    Daniel

  3. Garvin Hicking commented <span data-processor="relativetime" data-value="2024-12-31T15:49:59+00:00" > 12/31/24, 15:49 </span>

    Great, thanks for the feedback. If you want you could vote on the patch on gerrit to push things forward. ;-)

  4. Garvin Hicking commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2025-01-02T11:00:09+00:00" > 01/02/25, 11:00 </span>

    Applied in changeset commit:d8a0ca3a3d65b1f9985650eb5ebfb26eece36031.