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