Gernott / mask

TYPO3 Extension Mask
https://www.facebook.com/typo3mask
GNU General Public License v2.0
130 stars 86 forks source link

IRRE fields not working #526

Closed artur-grigoryan-cgn closed 2 years ago

artur-grigoryan-cgn commented 2 years ago

Hello, i'm using Mask 8.0 and TYPO3 11.5. when i try to use an repeatable field i get the following error with the generated example-code:

PHP Warning: Invalid argument supplied for foreach() in /home/haki/IdeaProjects/p0005-sc-typo3-project/vendor/typo3fluid/fluid/src/ViewHelpers/ForViewHelper.php line 131

examplecode:

<f:if condition="{data.tx_mask_test}">
    <ul>
        <f:for each="{data.tx_mask_test}" as="data_item">
            <li>
                <f:if condition="{data_item.tx_mask_test}">
                    {data_item.tx_mask_test -> f:format.nl2br()}
                </f:if>
            </li>
        </f:for>
    </ul>
</f:if>

If i delete the content of the foreach i get:

The argument "each" was registered with type "array", but is of type "integer" in view helper "TYPO3Fluid\Fluid\ViewHelpers\ForViewHelper".

with this code:

<f:if condition="{data.tx_mask_test}">
    <ul>
        <f:for each="{data.tx_mask_test}" as="data_item">
        </f:for>
    </ul>
</f:if>
{data.tx_mask_test} the integer 2 (two elements).
nhovratov commented 2 years ago

Hey, thanks for testing Mask v8 already. I will have a look what went wrong. You can use the latest v7 release for the time being.

artur-grigoryan-cgn commented 2 years ago

Seems like i have the same problem with v7.2.13. Is there something i can do to debug?

nhovratov commented 2 years ago

Hey, ok. In this case there is most probably something wrong on your end. Do you have any TCA overrides for this repeating field? Try a minimal setup, so you can reproduce the bug. If you want to dive deep, debug the InlineHelper class and the methods (fillInlineField and getInlineElements).

artur-grigoryan-cgn commented 2 years ago

I have another extension running, wich was builded with mask+mask export. Is this a problem?

nhovratov commented 2 years ago

Hm, I've never tried running those is parallel. In theory they shouldn't interfere each other. Can you disable the other extension and see, if it works then?

artur-grigoryan-cgn commented 2 years ago

I just tried and get the same problem. :/ I would be suprised if it was a problem. The error says that it tries to iterate the integer and not the table in the for each. i dont have any tca overrides. :/

nhovratov commented 2 years ago

Well, the only thing I can offer you is to send me your mask json file(s) and I can test it. This way we can ensure if it is a Mask problem or not.

artur-grigoryan-cgn commented 2 years ago

Do you thinbk the json can be the problem? there are just two elements. The IRRE and a Text input inside. I deleted and recreated it multiple times with different versions

nhovratov commented 2 years ago

One idea: You didn't by any chance override the MaskProcessor?

artur-grigoryan-cgn commented 2 years ago

It wasn't set. Guess who forgot to Include the extension in the template. Sorry! If you wonder how the template for was loaded, i hade this in my setup.typescript:

lib {
    maskContentElement = FLUIDTEMPLATE
    maskContentElement {
        partialRootPaths {
            30 = EXT:sc_sitepackage/Resources/Private/Partials/

        }
    }
}

Copied it from another project. Sorry for the work!