Issue Bug Closed

#92892RTE in TCA of type='flex' in combination with type='array' in flexform adds empty <p>&nbsp ;</p>

Paul Kamma 11/20/20, 15:19 updated 07/04/24, 09:36

Description

I have the following setup to extend a TCA of a Model

$GLOBALS['TCA']['tx_myExtension_domain_model_event']['columns']['attributes']['config'] = [
    'type' => 'flex',
    'ds' => [
        'default' => 'FILE:EXT:myExtension/Configuration/FlexForms/event.xml',
    ],
];

the flexForm looks like this:

<T3DataStructure>
  <ROOT>
    <type>array</type>
    <el>
      <attributes>
        <TCEforms>
          <section>1</section>
          <title>Attributes</title>
          <type>array</type>
          <el>
            <attribute>
              <title>Attribute</title>
              <type>array</type>
              <el>
                <info>
                  <TCEforms>
                    <label>Copy</label>
                    <config>
                      <type>text</type>
                      <rows>5</rows>
                      <cols>30</cols>
                      <eval>trim</eval>
                      <enableRichtext>true</enableRichtext>
                    </config>
                  </TCEforms>
                </info>
              </el>
            </attribute>
          </el>
        </TCEforms>
      </attributes>
    </el>
  </ROOT>
</T3DataStructure>
When I add a “Attribute” element within the Section and type text with two paragraphs. After saving the RTE creates an Additional paragraph between the two inserted with

&nbsp ;

.
Looks like that it the

&nbsp ;

appears when it converts the empty lines to the empty paragraphs. They are not written in the DB.

Reviews 1

History 67

  1. Benjamin Franzke commented 01/06/21, 08:17

    Does the behavior perist, when you add

    <richtextConfiguration>default</richtextConfiguration>

    into <config>?

  2. Paul Kamma commented 01/06/21, 08:22

    Benjamin Franzke wrote in #note-1:
    > Does the behavior perist, when you add
    >
    > […]
    >
    > into <config>?

    Yes it does.

  3. Paul Kamma commented 10/28/21, 18:28

    OK I have to solve this riddle.
    After I’ve stumbled upon this problem again in a new Project but also noticed that it doesn’t appeared in an another I’ve compared the FlexForms and noticed that in the “Buggy” one the XML structure was different.
    This one is wrong:

    <T3DataStructure>
      <ROOT>
        <type>array</type>
        <el>
          <attributes>
            <TCEforms>
              <section>1</section>
              <title>Attributes</title>
              <type>array</type>
              <el>
                <attribute>
                  <title>Attribute</title>
                  <type>array</type>
                  <el>
                    <info>
                      <TCEforms>
                        <label>Copy</label>
                        <config>
                          <type>text</type>
                          <rows>5</rows>
                          <cols>30</cols>
                          <eval>trim</eval>
                          <enableRichtext>true</enableRichtext>
                        </config>
                      </TCEforms>
                    </info>
                  </el>
                </attribute>
              </el>
            </TCEforms>
          </attributes>
        </el>
      </ROOT>
    </T3DataStructure>

    and this one is the correct:

    <T3DataStructure>
      <ROOT>
        <type>array</type>
        <el>
          <attributes>
            <section>1</section>
            <title>Attributes</title>
            <type>array</type>
            <el>
              <attribute>
                <title>Attribute</title>
                <type>array</type>
                <el>
                  <info>
                    <TCEforms>
                      <label>Copy</label>
                      <config>
                        <type>text</type>
                        <rows>5</rows>
                        <cols>30</cols>
                        <eval>trim</eval>
                        <enableRichtext>true</enableRichtext>
                      </config>
                    </TCEforms>
                  </info>
                </el>
              </attribute>
            </el>
          </attributes>
        </el>
      </ROOT>
    </T3DataStructure>

    You’ll notice that the <TCEforms> tags disappeared, they caused the strange behaviour, in the Backend the form were rendered without problems but it looks like that parsing after the save (when loading the flexform content) caused an parsing issue and added empty stuff. I don’t really know but I’m happy that I found out what caused the problem :)

    The issue can be closed.

  4. Gerrit Code Review pushed patch set 1 for main to change 73994 status New Under Review 03/18/22, 09:27

  5. Paul Kamma commented 03/18/22, 12:11

    Gerrit Code Review wrote in #note-4:
    > Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
    > It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/73994

    So is this actually a bug? Or is it just a preventation to avoid this issue?

  6. Riccardo De Contardi commented 07/04/24, 09:30

    Just a note: if I am not wrong <TCEforms> is not evaluated anymore since TYPO3 12 – see
    https://docs.typo3.org/m/typo3/reference-coreapi/12.4/en-us/ApiOverview/FlexForms/Index.html#flexforms

  7. Riccardo De Contardi commented and changed status Under Review Closed Tags rte flexform rte, flexform 07/04/24, 09:36

    I close this issue – as I wrote on my previous comment the removal of <TCEforms> is part of the upgrade path of the CMS and documented.

    If you think that this is the wrong decision or experience the issue again (e.g. on TYPO3 12 or later) and there is still work to do on this topic, please reopen it or open a new issue with a reference to this one.

    Thank you.