Search code examples
typo3fluidflux

TYPO3: Rename flux fields and keep the values?


Usually when renaming a flux field, the old values are not transfered and have to be entered again. Is there a way to keep the values after renaming a flux field?

Let's look at this simple flux configuration for example:

<f:section name="Configuration">
    <flux:form id="article" icon="{f:uri.resource(path: 'Icons/Content/Example.svg')}" options="{group: 'FCE'}">
        <flux:field.text name="text" rows="1"/>
    </flux:form>
</f:section>

If I now rename the field text to title all previously entered values for text are lost:

<f:section name="Configuration">
    <flux:form id="article" icon="{f:uri.resource(path: 'Icons/Content/Example.svg')}" options="{group: 'FCE'}">
        <flux:field.text name="title" rows="1"/>
    </flux:form>
</f:section>

Is it possible to somehow let flux know, that the field title is supposed to have the values of the former field text?


Solution

  • Short answer: no.

    If I now rename the field text to title all previously entered values for text are lost

    Long answer: in fact, they are still present in stored XML from FlexForm, but with old name. There are two reasons for this:

    1. This is not technically possible to determine, that the field was renamed. Because the end result is same, as field was deleted and a new was created.
    2. Imagine a situation, that you have two page templates, where first one contains field of name text and second - title. You set first template as page template and fill text with something. Then you change template to second one - should now title contain previously filled value? Then you switch back to the first template - should the text be restored (in fact it is restored, because Flux doesn't delete it)? And now combine it with inheritance of templates and see, which mess can happen.