typo3typoscriptfluid

TYPO3 12: Set TypoScript constant as integer


So I'm currently updating a TYPO3 website from v11 to v12 and I've run into a problem I can't seem to fix. In my fluid template I'm generating a filter form using AJAX. To do that I'm assigning the AJAX PageType to the form. Since the number I'm setting is used in multiple places, I have a constant defined for it.

Since updating to TYPO3 12 I'm getting the following error:

TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder::setTargetPageType(): Argument #1 ($targetPageType) must be of type int, string given

Here's part of my code:
HTML

<f:form action="list" method="GET" name="overwriteDemand" pageType="{settings.tx_t8_references_ajaxpage}">

TypoScript constant

plugin.tx_t8references {
    ajaxPage = 427592
}

TypoScript setup

plugin.tx_t8references {
    settings {
        tx_t8_references_ajaxpage = {$plugin.tx_t8references.ajaxPage}
    }
}

Here's the output I get when using <f:debug>{settings.tx_t8_references_ajaxpage}</f:debug>:
Debugger output

How can I make it so that the constant I've set is of type integer?

Any help is appreciated, thank you in advance.


Solution

  • As mentioned in the comments above. This is a bug in the FormViewHelper. Until the bug is fixed you could do the following:

    EXT:vhs comes with an convert ViewHelper.

    https://github.com/FluidTYPO3/vhs/blob/development/Classes/ViewHelpers/Variable/ConvertViewHelper.php

    If you dont want to install vhs you could copy the ViewHelper to your own extension.