T3Voila / templavoilaplus

TYPO3 Extension TemplaVoilà! Plus for TYPO3 8/9/10/11/12 LTS
https://extensions.typo3.org/extension/templavoilaplus/
GNU General Public License v2.0
26 stars 27 forks source link

Invalid TCA internal_type of field "field_image" in table tt_content: Must not be set, or set to "folder". #488

Open derBoogie opened 1 year ago

derBoogie commented 1 year ago

After the update to TYPO3 11.5 and TV+ 8.1.2 the following error occurs when editing an FCE with image fields:

_Invalid TCA internal_type of field "field_image" in table ttcontent: Must not be set, or set to "folder".

Here is the corresponding XML-configuration:

...
<el type="array">
    <field_image type="array">
        <TCEforms type="array">
            <label></label>
            <config type="array">
                <type>group</type>
                <internal_type>file</internal_type>
                <allowed>gif,png,jpg,jpeg,svg</allowed>
                <max_size>1000</max_size>
                <uploadfolder>uploads/tx_templavoila</uploadfolder>
                <size>1</size>
                <maxitems>1</maxitems>
                <minitems>0</minitems>
            </config>
        </TCEforms>
        <type>element</type>
        <title>Bild</title>
    </field_image>
</el>

How can I fix this?

opi99 commented 1 year ago

This was discussed the days on the TYPO3 TemplaVoila+ slack channel. I didn't recognized this issue, cause I migrated to FAL already. So this is missing yet and I need to add this functionality as group-file isn't supported anymore by TYPO3 Core

derBoogie commented 1 year ago

This was me on the TemplaVoila+ slack channel.

Here is the migration of the image field date structure XML to FAL:

<el type="array">
    <field_image type="array">
        <TCEforms>
            <label>Bild</label>
            <config>
                <type>inline</type>
                <maxitems>1</maxitems>
                <foreign_table>sys_file_reference</foreign_table>
                <foreign_table_field>tablenames</foreign_table_field>
                <foreign_label>uid_local</foreign_label>
                <foreign_sortby>sorting_foreign</foreign_sortby>
                <foreign_field>uid_foreign</foreign_field>
                <foreign_selector>uid_local</foreign_selector>
                <foreign_selector_fieldTcaOverride>
                    <config>
                        <appearance>
                            <elementBrowserType>file</elementBrowserType>
                            <elementBrowserAllowed>gif,jpg,jpeg,png,svg</elementBrowserAllowed>
                        </appearance>
                    </config>
                </foreign_selector_fieldTcaOverride>
                <foreign_types type="array">
                    <numIndex index="0">
                        <showitem>--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette</showitem>
                    </numIndex>
                    <numIndex index="2">
                        <showitem>--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette</showitem>
                    </numIndex>
                </foreign_types>
                <foreign_match_fields>
                    <fieldname>field_image</fieldname> <!-- This is the field name -->
                </foreign_match_fields>
                <appearance type="array">
                    <newRecordLinkAddTitle>1</newRecordLinkAddTitle>
                    <headerThumbnail>
                        <field>uid_local</field>
                        <height>100</height>
                        <width>70</width>
                    </headerThumbnail>
                    <enabledControls>
                        <info>1</info>
                        <new>0</new>
                        <dragdrop>0</dragdrop>
                        <sort>1</sort>
                        <hide>0</hide>
                        <delete>1</delete>
                        <localize>1</localize>
                    </enabledControls>
                    <createNewRelationLinkTitle>LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference</createNewRelationLinkTitle>
                </appearance>
                <behaviour>
                    <localizationMode>select</localizationMode>
                    <localizeChildrenAtParentLocalization>1</localizeChildrenAtParentLocalization>
                </behaviour>
                <overrideChildTca>
                    <columns type="array">
                        <uid_local type="array">
                            <config type="array">
                                <appearance type="array">
                                    <elementBrowserType>file</elementBrowserType>
                                    <elementBrowserAllowed>jpg,png,svg,jpeg,gif</elementBrowserAllowed>
                                </appearance>
                            </config>
                        </uid_local>
                    </columns>
                    <types type="array">
                        <numIndex index="2">
                            <showitem>--palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette,--palette--;;filePalette</showitem>
                        </numIndex>
                    </types>
                </overrideChildTca>
            </config>
        </TCEforms>
    </field_image>
</el>

and the corresponding typoscript mapping configuration:

10 = FILES
10 {
    references {
        table = tt_content
        uid.data = TSFE:register|tx_templavoilaplus_pi1.parentRec.uid
        fieldName = field_image
    }
    renderObj = IMAGE
    renderObj {
        file {
            import.data = file:current:publicUrl
            width = 567
            height = 360c
        }
    }
}
opi99 commented 1 year ago

Ahh, ok, fine, thanks for your input. We need a migration of the files to the correct location together with the entries in sys_file_reference.

As note to your TypoScript, you have a FAL object, retries the publicUrl to import it and retrieve the FAL object from this publicUrl (Browser) on the local file system. This works as long as you have an absolute and a local FileStorage.

You should be able to use import = file:current, which uses the FAL object directly (I do not find correct examples yet and I'm not on my working machine).

gregordonsky commented 1 year ago

I think this should be the typoscript without using publicUrl

10 = FILES
10 {
    references {
        table = tt_content
        uid.data = TSFE:register|tx_templavoilaplus_pi1.parentRec.uid
        fieldName = field_image
    }
    renderObj = IMAGE
    renderObj {
        file {
            import.data = file:current:uid
                        treatIdAsReference = 1
            width = 567
            height = 360c
        }
    }
}
arappel commented 11 months ago

Hello,

I'm embedding TemplaVoila like this

page = PAGE page.typeNum = 0 page.10 = USER page.10.userFunc = Tvp\TemplaVoilaPlus\Controller\Frontend\FrontendController->renderPage page.10.disableExplosivePreview = 1

Where do I have to put the typoscript you posted above to work around the issue (sorry, I'm a rookie)?

The XML works but the image is not rendered in the frontend.

Thanks and kind regards

opi99 commented 9 months ago

Hi @arappel

this needs to be done inside the Mapping Configuration for the field.

Example (but with another TypoScript): https://github.com/T3Voila/t3voila_uikit/blob/main/Resources/Private/Mappings/Content/Accordeon.tvp.yaml#L26

opi99 commented 9 months ago

Excuse, the migration of the file field is still an issue.

opi99 commented 3 months ago

Oh, there was never a core migrator for this https://github.com/TYPO3/typo3/blob/9.5/typo3/sysext/core/Classes/Migrations/TcaMigration.php#L2591

derBoogie commented 3 months ago

Oh, there was never a core migrator for this https://github.com/TYPO3/typo3/blob/9.5/typo3/sysext/core/Classes/Migrations/TcaMigration.php#L2591

Can you provide this in the next version (for TYPO3 11 and 12)?

opi99 commented 3 months ago

@derBoogie Did you need to update more, then only the XML of the DataStructure? Or do we need to migrate also the files? (I've no old installation here, so I don't know, how this was saved inside the database).