stmllr.net

Add CSH to TYPO3 FlexForm fields

by on stmllr.net

In the previous article I came up with a short introduction to adding context sensitive help to backend modules of TYPO3. Now let's have a look at FlexForms.

As already shown in the previous article about context sensitive help (CSH), adding CSH to backend modules does not mean much effort. What about FlexForms?

Since TYPO3 4.2 CSH is also supported for FlexForm fields. Integration is very easy since you only have to create a file with the CSH content and add a line to your FlexForm pointing to that file. Have a look at the following example.

As always the FlexForm is configured in XML. The item which points to the location of the CSH content must be placed inside the <ROOT><TCEforms> tags. The name of the element is cshFile (and it's case sensitive!).

The FlexForm file your_extkey/pi1/flexform_ds.xml looks like this:

<T3DataStructure>
<meta>
  <langDisable>1</langDisable>
  </meta>
  <sheets>
  <sDEF>
    <ROOT>
      <TCEforms>
        <sheetTitle>The title of the sheet</sheetTitle>
          <cshFile>LLL:EXT:your_extkey/pi1/locallang_csh_flexform.xml</cshFile>
        </TCEforms>
        <type>array</type>
        <el>
        <yourField>
          <TCEforms>
             <label>Label of the the field</label>
              <config>
                ... field configuration ...
              </config>
           </TCEforms>
          </yourField>
        </el>
      </ROOT>
    </sDEF>
 </sheets>
</T3DataStructure>

The significant line is marked in strong letters. Next step is to add the CSH content as already shown in the previous article.

The file should be named your_extkey/pi1/locallang_csh_flexform.xml

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<T3locallang>
  <meta type="array">
    <description>CSH labels for FlexForm fields</description>
    <type>CSH</type>
    <csh_table></csh_table>
    <fileId>EXT:your_extkey/pi1/locallang_csh_flexform.xml</fileId>
    <labelContext type="array"></labelContext>
  </meta>
  <data type="array">
    <languageKey index="default" type="array">
      <label index="yourField.alttitle">alternative title</label>
      <label index="yourField.description">description</label>
      <label index="yourField.details">details</label>
      <label index="yourField.syntax">syntax</label>
      <label index="yourField.image_descr">image caption</label>
      <label index="yourField.image">gfx/i/pages.gif</label>
      <label index="yourField.seeAlso">pages:starttime</label>
    </languageKey>
  </data>
</T3locallang>

That's even more simple than adding CSH to a BE module. At the time of writing this article, one features does not yet work as it does for TCA fields. Hovering the mouse pointer over a field title should trigger a popup which shows the title and description of the field. This does not work in FlexForms. I have opened a bug and submitted a patch to the core list to fix this issue and hope it will be resolved in the forthcoming 4.3 release. In the context of the bugreport you can also find a test extension, which serves as a showcase for FlexForm CSH integration.

Tags

Comments

  1. Steffen

    Please note that the CSH API for FlexForms has changed with TYPO3 4.5. You can find an article about the changes on buzz: http://buzz.typo3.org/teams/core/article/getting-ready-for-45-changes-in-csh-for-flexforms/