Project

General

Profile

Actions

Bug #89263

open

TCEMAIN.preview doesn't work for routed controller with empty arguments

Added by Robert Wolle over 4 years ago. Updated about 3 years ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Link Handling, Site Handling & Routing
Target version:
-
Start date:
2019-09-25
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
9
PHP Version:
7.2
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

It's said in the subject and it has nothing to do with the news extension.

Example:

Site configuration (yaml):

routeEnhancers:
  NewsPlugin:
    type: Extbase
    extension: News
    plugin: Pi1
    routes:
      - routePath: '/news/{news_title}'
        _controller: 'News::detail'
        _arguments:
          news_title: news
    aspects:
      news_title:
        type: PersistedAliasMapper
        tableName: tx_news_domain_model_news
        routeFieldName: path_segment

Page tsconfig:

TCEMAIN{
    preview {
        tx_news_domain_model_news {
            useCacheHash = 1
            previewPageId = 123
            useDefaultLanguageRecord = 0
            fieldToParameterMap {
                uid = tx_news_pi1[news_preview]
            }
            additionalGetParameters {
                tx_news_pi1.controller = News
                tx_news_pi1.action = detail
            }
        }
    }
}

When I will access the preview, it gives the following error:
(1/1) Symfony\Component\Routing\Exception\InvalidParameterException
Parameter "tx_news_pi1__news" for route "tx_news_pi1_0" must match "[^/]++" ("" given) to generate a corresponding URL.

Because of having no tx_news_pi1[news] variable, the url cannot be generated. It seems to be required always.

I tried to set the variable like this "{news_title?}" in the yaml configuration, wich is not respected (https://symfony.com/doc/current/routing.html#optional-parameters).
Also I found an option "strict_requirements", which will generate the url, when I set it in the core of the vendor (defined in vendor/symfony/routing/Route.php, set in vendor/symfony/routing/Router.php).

In the core of Typo3 the routing has no option, which I can set ("strict_requirements" option or the variable "{news_title?}" in yaml).

To set the news parameter like this "TCEMAIN.preview.tx_news_domain_model_news.additionalGetParameters.tx_news_pi1.news = " will produce an error too.


Related issues 4 (1 open3 closed)

Related to TYPO3 Core - Bug #87333: Slug fieldSeparator default value collides with symfony strict requirementsClosed2019-01-05

Actions
Related to TYPO3 Core - Bug #88291: Exception thrown if slash in route field of PersistedPatternMapper aspectClosed2019-05-07

Actions
Related to TYPO3 Core - Bug #90531: Requirements are not considered when an aspect is presentClosed2020-02-25

Actions
Related to TYPO3 Core - Bug #92409: Regression with Save and Preview ButtonAccepted2020-09-25

Actions
Actions #1

Updated by Christian Eßl over 4 years ago

  • Category set to Link Handling, Site Handling & Routing
Actions #2

Updated by Robert Wolle over 4 years ago

The feature, which was introduced in TYPO3 CMS 7 LTS, is not available anymore in TYPO3 CMS 9 LTS, if you use the same action for showing the live ("news" argument) and preview ("news_preview" argument) content.

Currently I add the following call in vendor/symfony/routing/Generator/UrlGenerator.php on line 171 before "foreach":

$this->setStrictRequirements(null);

This avoids the exception.

Actions #3

Updated by Christian Eßl about 4 years ago

  • Related to Bug #87333: Slug fieldSeparator default value collides with symfony strict requirements added
Actions #4

Updated by Christian Eßl about 4 years ago

  • Related to Bug #88291: Exception thrown if slash in route field of PersistedPatternMapper aspect added
Actions #5

Updated by Christian Eßl about 4 years ago

  • Related to Bug #90531: Requirements are not considered when an aspect is present added
Actions #6

Updated by Michael Christian about 4 years ago

BE Preview is still not working with 9.5.14.
Here ist the documentation to preview: https://docs.typo3.org/m/typo3/reference-tsconfig/master/en-us/PageTsconfig/TceMain.html

The following parameter is working (example with news):

TCEMAIN.preview.tx_news_domain_model_news.previewPageId = 123

The following parameter is not working (example with news):

TCEMAIN.preview.tx_news_domain_model_news.fieldToParameterMap.uid = tx_news_pi1[news_preview]

Can someone please fix this!

Actions #7

Updated by Patrick Lenk almost 4 years ago

I can confirm with 9.5.18 that additionalGetParameters is not working anymore, in my example with tt_news.

Actions #8

Updated by Felix Jacobi over 3 years ago

  • Related to Bug #92409: Regression with Save and Preview Button added
Actions #9

Updated by Jo Hasenau over 3 years ago

While the slug generation itself is still broken, the preview is actually working as soon as you have the configuration on both, source and target page, which is due to #92409

Actions #10

Updated by Patrick Lenk about 3 years ago

Jo Hasenau wrote in #note-9:

While the slug generation itself is still broken, the preview is actually working as soon as you have the configuration on both, source and target page, which is due to #92409

Thanks, that works!

Actions

Also available in: Atom PDF