2016-08-23 8 views
2

Ich habe eine Erweiterung typo3.Ich muss die Grundkonfiguration mit flex Formen speichern.So, dass ich ein Flex-Formular geschrieben hat.Aber kann nicht auf diese Werte im Controller zugreifen.Flex-Formular-Konfiguration in der Steuerung - typo3

ist mein Code unten angegeben

ext_tables.php

$extensionName = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY); 
$frontendpluginName = 'userform'; //Your Front-end Plugin Name 
$pluginSignature = strtolower($extensionName) . '_'.strtolower($frontendpluginName); 
$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform'; 
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/user_flexform.xml'); 

user_flexform.xml

<T3DataStructure> 
    <sheets> 
     <sDEF> 
      <ROOT> 
       <TCEforms> 
        <sheetTitle>Data Table Config</sheetTitle> 
       </TCEforms> 
       <type>array</type> 
       <el> 

        <switchableControllerActions> 
         <TCEforms> 
          <label>Phone Number Format</label> 
          <config> 
           <type >select</type> 
           <items name="settings.phone" type="array"> 
            <numIndex index="0" type="array"> 
              <numIndex index="0">US</numIndex> 
              <numIndex index="1">(678) 567-1234</numIndex> 
            </numIndex> 
            <numIndex index="1" type="array"> 
             <numIndex index="0">India</numIndex> 
             <numIndex index="1">+91 6789765434</numIndex> 
            </numIndex> 
           </items> 
          </config> 
         </TCEforms> 
        </switchableControllerActions> 
       </el> 
      </ROOT> 
     </sDEF> 
    </sheets> 
</T3DataStructure> 

user_controller.php

$config = $this->settings; 

Antwort

3

Die switchableControllerActions t verwendet wird, o Wählen Sie eine Aktion. Dies ist keine normale Einstellung. Diese sind ein bisschen anders

<T3DataStructure> 
    <sheets> 
     <sDEF> 
      <ROOT> 
       <TCEforms> 
        <sheetTitle>Data Table Config</sheetTitle> 
       </TCEforms> 
       <type>array</type> 
       <el> 
       <switchableControllerActions> 
        <TCEforms> 
         <label>LLL:EXT:news/Resources/Private/Language/locallang_be.xlf:flexforms_general.mode</label> 
         <onChange>reload</onChange> 
         <config> 
          <type>select</type> 
          <items> 
           <numIndex index="1"> 
            <numIndex index="0">Company</numIndex> 
            <numIndex index="1">Company->list;Company->show</numIndex> 
           </numIndex> 
           <numIndex index="2"> 
            <numIndex index="0">Product</numIndex> 
            <numIndex index="1">Product->list;Product->show</numIndex> 
           </numIndex> 
          </items> 
         </config> 
        </TCEforms> 
       </switchableControllerActions> 
        <settings.phone> 
         <TCEforms> 
          <label>Phone Number Format</label> 
          <config> 
           <type >select</type> 
           <items> 
            <numIndex index="0" type="array"> 
              <numIndex index="0">US</numIndex> 
              <numIndex index="1">(678) 567-1234</numIndex> 
            </numIndex> 
            <numIndex index="1" type="array"> 
             <numIndex index="0">India</numIndex> 
             <numIndex index="1">+91 6789765434</numIndex> 
            </numIndex> 
           </items> 
          </config> 
         </TCEforms> 
        </settings.phone> 
       </el> 
      </ROOT> 
     </sDEF> 
    </sheets> 
</T3DataStructure> 

definiert Wenn Sie die switchableControllerActions nicht brauchen, dann ist es einfach zu entfernen.

Beachten Sie, dass nach dem Speichern von flexform mit diesen kann es zu Nebenwirkungen kommen, da diese weiterhin bestehen bleiben, obwohl Sie sie in Ihren flexforms entfernt haben. Am besten ist es daher, das Plugin zu entfernen und ein neues zu erstellen!

+0

Ich habe ein Array Array (1 Artikel) Blog => Array (1 Artikel) max => '0' (1 Zeichen) –

+0

@Georg Ringer .. einen Punkt gesagt, wenn eine Konfiguration von der geändert wird flexform werden dann noch die alten Werte in entsprechenden Tabellen im XML-Format gespeichert. Also lass die aktuelle Erweiterung lieber und baue eine neue. –