Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inhertitance of settings - empty XML value breaks it #712

Closed
githubrsys opened this issue Nov 14, 2014 · 4 comments
Closed

Inhertitance of settings - empty XML value breaks it #712

githubrsys opened this issue Nov 14, 2014 · 4 comments
Milestone

Comments

@githubrsys
Copy link

Summary

While this problem is with pages I think the problem itself relies in flux.

I want to give editors the opportunitiy to define where the mainmenu shall begin. I have a constant for this and a setting in the flux page-configuration form of the page settings.

For somplicity I've got 2 pages. id=3 and id=7. id=7 is a child of id=3. As soon I set something in Page Configuration - subpages of id=3 the expected value is set in FE as expected and inherited by id=7 in FE.

  • If I now open the page settings of id=7 I see a value inherited from id=3 (BTW: inherited values should be marked visible as inherited).
  • If I now hit save button without changing anything a xml value is written to pages:tx_fed_page_flexform
    shortened: <field index="settings.mainMenuRootPageUid"> <value index="vDEF">3</value> </field> of id=7
  • If I now change the value to something different in id=7 it works as expected and the menu gets rendered from a different source
  • If I remove the value from the field and hit save the db entry changes to: <field index="settings.mainMenuRootPageUid"> <value index="vDEF"></value> </field>
  • But now the inheritance from id=3 is broken. Which IMHO should not be the case. settings.mainMenuRootPageUid is empty in FE but should be inherited from id=3 or from the constant
  • The clear attribute seems to have no impact of anything at all - no matter if used or not
If I truncate the pages:tx_fed_page_flexform field in DB of id=7 the inheritance is working again

And If I do not use the flux but constants at all it also works as expected but granting editors access to the constants seems to me not the real deal.

The sheet looks like this

<flux:form.sheet name="menusettings" label="Menü">
            <flux:field.input size="4"  clear="true" inheritEmpty="false" name="settings.mainMenuRootPageUid" label="foo">
                <flux:wizard.link label="Auswählen" activeTab="pagetree"></flux:wizard.link>
            </flux:field.input>
        </flux:form.sheet>

FE Template looks like this

<ul id="mainMenu" class="rp{settings.mainMenuRootPageUid}" role="menu">
                <v:page.menu accesskey="m" as="menu" classFirst="first" classLast="last" classActive="active" classCurrent="current" classHasSubpages="hasSub" expandAll="true" levels="5" useShortcutData="true" pageUid="{settings.mainMenuRootPageUid}">
 </v:page.menu>
            </ul>
@NamelessCoder
Copy link
Member

If I remove the value from the field and hit save the db entry changes to:

...indicates that you don't use the clear value wizard which means an empty value gets stored. Perhaps you misunderstand the purpose of inheritEmpty - to clarify: enabling this toggle means that children are allowed to inherit the value from the parent even if it is empty. It does not mean that if the value is empty (but saved to DB) on children, it would get overridden by the parent value. It is possible that you have located a bug in the clear attribute when combined with nested wizards - clear emulates a wizard and may be overwritten by the custom ones. To confirm this please try saving w/ clear enabled after temporarily removing (not commenting out) the link wizard you use. And of course I'd appreciate a report about the outcome.

(BTW: inherited values should be marked visible as inherited)

We don't actually control the HTML output of fields. We are, by choice, limited to using the options presented to us through TCEforms - which supports a default value, but no custom stylings or HTML modifications based on the value of the field. We can modify the value itself, but this would cause ill effects when saving the data. We cannot on-the-fly translate or append to labels coming from LLL files so we are quite unable to fulfil that request.

@githubrsys
Copy link
Author

...indicates that you don't use the clear value wizard which means an empty value gets stored.

If I remove the wizard.link within the input field AND remove the value by hand AND check the clear checkbox - the XML looks like this in id=7

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3FlexForms>
    <data>
        <sheet index="menusettings">
            <language index="lDEF">
                <field index="settings.mainMenuRootPageUid">
                    <value index="vDEF"></value>
                </field>
                <field index="settings.footerMenuRootPageUid">
                    <value index="vDEF"></value>
                </field>
                <field index="settings.footerMenuContentPageUid">
                    <value index="vDEF"></value>
                </field>
                <field index="settings.mainMenuRootPageUid_clear">
                    <value index="vDEF">1</value>
                </field>
                <field index="settings.footerMenuRootPageUid_clear">
                    <value index="vDEF">1</value>
                </field>
                <field index="settings.footerMenuContentPageUid_clear">
                    <value index="vDEF">1</value>
                </field>
            </language>
        </sheet>
    </data>
</T3FlexForms>

Perhaps you misunderstand the purpose of inheritEmpty - to clarify: enabling this toggle means that children are allowed to inherit the value from the parent even if it is empty. It does not mean that if the value is empty (but saved to DB) on children, it would get overridden by the parent value.

Seems to be quite hard to misunderstand that. As you can see I've set the disable flag. But in id=3 it is defined for subpage inheritance. But IMHO if this value is empty, the information should be taken from constants if set there and not no output in FE. As long as the XML is not written at all, it happens like expected. Only if the XML is within the DB field the pain starts.

To confirm this please try saving w/ clear enabled after temporarily removing (not commenting out) the link wizard you use

I did no remove the value by hand but checked the clear checkbox and hit save. The DB looks like this -Is this wanted?:

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3FlexForms>
    <data>
        <sheet index="menusettings">
            <language index="lDEF">
                <field index="settings.mainMenuRootPageUid">
                    <value index="vDEF">3</value>
                </field>
                <field index="settings.footerMenuRootPageUid">
                    <value index="vDEF">3</value>
                </field>
                <field index="settings.footerMenuContentPageUid">
                    <value index="vDEF">3</value>
                </field>
                <field index="settings.mainMenuRootPageUid_clear">
                    <value index="vDEF">1</value>
                </field>
                <field index="settings.footerMenuRootPageUid_clear">
                    <value index="vDEF">1</value>
                </field>
                <field index="settings.footerMenuContentPageUid_clear">
                    <value index="vDEF">1</value>
                </field>
            </language>
        </sheet>
    </data>
</T3FlexForms>

limited to using the options presented to us through TCEforms - which supports a default value, but no custom stylings or HTML modifications based on the value of the field

Perhaps you see the magic of the idea. Perhaps somebody of the core team does also. It seems to me useful to have a repoding service for purposes like this. Perhaps a forge issue in core makes sense?!

@githubrsys
Copy link
Author

  • In the end the clear wizard does not remove anything AFAIS
  • Values from id=3 are inherited in id=7 in the flexform if page-settings is opened -> This can be caused due the fact that in id=3 page-settings - page-configuration subpage a value is defined. -> Although a no inheritance flag is set within the fluxfield itself
  • The real problem to me is, that my constant is getting overruled by the empty xml value/field -> which is generated automatically as soon any pagesetting is touched in backend flexform and save is hit

@NamelessCoder NamelessCoder added this to the 7.2 milestone Jan 16, 2015
@NamelessCoder
Copy link
Member

Related to #727

NamelessCoder added a commit to FluidTYPO3/fluidpages that referenced this issue Mar 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants