1
votes

I have a plugin for a custom content element. The plugin contains a flexform. I'd like to use a value from the flexform in my TypoScript setup. How can I do this?

More specifically, the flexform is defined as:

 <T3DataStructure>
  <meta>
    <langDisable>1</langDisable>
  </meta>
  <sheets>
    <sDEF>
      <ROOT>
        <TCEforms>
          <sheetTitle>LLL:EXT:cb_foundation/Resources/Private/Language/locallang_db.xlf:magellan.sheetTitle</sheetTitle>
        </TCEforms>
        <type>array</type>
        <el>
          <settings.magellan.cols>
            <TCEforms>
              <label>LLL:EXT:cb_foundation/Resources/Private/Language/locallang_db.xlf:magellan.cols</label>
              <config>
                <type>input</type>
                <size>20</size>
                <eval>trim</eval>
              </config>
            </TCEforms>
          </settings.magellan.cols>
        </el>
      </ROOT>
    </sDEF>
  </sheets>
</T3DataStructure>

My custom element is added to tt_content using the following TypoScript:

lib.cb_foundation.magellan = HMENU
lib.cb_foundation.magellan {
    1 = TMENU
    1 {
        sectionIndex = 1
        sectionIndex.type = header
        sectionIndex.useColPos = 0
        wrap = <div data-magellan-expedition="fixed"><dl class="sub-nav"> | </dl></div>
        NO {
            allWrap = <dd data-magellan-arrival="c{field:sectionIndex_uid}">|</dd>
            allWrap.insertData = 1
        }
    }
    special = list
    special.value.data = page:uid
}

tt_content.cbfoundation_magellan =< lib.cb_foundation.magellan

What I want to do is to set tt_content.cbfoundation_magellan.1.sectionIndex.useColPos using the value found in the flexform. How can I do that?

4

4 Answers

4
votes

This is not possible. Typoscript does not parse values from a flexform, unfortunately.

You need an extbase controller or pi1 to get the values from the flexform and assign them to a separate template which renders your custom content element.

Extbase Example:

class ContentElementsController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {

    public function YourContentElementAction() {
        // Get the data object (contains the tt_content fields)
        $data = $this->configurationManager->getContentObject()->data;

        // Append flexform values
        $this->configurationManager->getContentObject()->readFlexformIntoConf($data['pi_flexform'], $data);

        // Assign to template
        $this->view->assign('data', $data);
    }

}
0
votes

I dont know, if the extension gridelements or TYPO3 6.2.26 bring the functionality, but the following works for me:

dataWrap = {field:flexform_YOURFIELD}
0
votes

The following StackOverflow answer describes, how plugin flexform settings of EXT News can be accessed from TS Setup using a small PHP USER Class:

https://stackoverflow.com/a/40006158/430742

It should be easy to adapt for other plugins and their flexform settings.

0
votes

As stated here there is a solution now in TYPO3 >= 8.4.

The feature is documented in the TYPO3 Core Changelog.