Add CSH to TYPO3 FlexForm fields

by on

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:

        <sheetTitle>The title of the sheet</sheetTitle>
             <label>Label of the the field</label>
                ... field configuration ...

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" ?>
  <meta type="array">
    <description>CSH labels for FlexForm fields</description>
    <labelContext type="array"></labelContext>
  <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>

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.



  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: