2017-01-02 45 views
4

這是我的代碼。我不知道錯誤在哪裏?請參考下面的代碼,並幫助我TYPO3 FlexForm未出現

$pluginSignature = str_replace('_','',$_EXTKEY) . '_rock'; 

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin('Rocktechnolabs.' . $_EXTKEY, 'rock', 'THE FAQS'); 

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/flexform_rock.xml'); 

in Configuration/FlexForms/flexform_rock.xml 

<T3DataStructure> 
    <sheets> 
     <sDEF> 
      <ROOT> 
       <TCEforms> 
        <sheetTitle>Function</sheetTitle> 
       </TCEforms> 
       <type>array</type> 
       <el> 
        <switchableControllerActions> 
         <TCEforms> 
          <label>Select function</label> 
          <config> 
           <type>select</type> 
           <items> 
            <numIndex index="0"> 
             <numIndex index="0">List</numIndex> 
             <numIndex index="1">Faq->list</numIndex> 
            </numIndex> 
            <numIndex index="1"> 
             <numIndex index="0">Search</numIndex> 
             <numIndex index="1">Faq->search</numIndex> 
            </numIndex> 
           </items> 
          </config> 
         </TCEforms> 
        </switchableControllerActions> 
       </el> 
      </ROOT> 
     </sDEF> 
    </sheets> 
</T3DataStructure> 

我試了很多,但我沒有得到選擇插件期間的flexform。你能幫我找出錯誤嗎?

回答

2

您必須將柔性成型字段添加到subtypes_addlist:

$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform'; 
+0

謝謝你的答案..我忘記了這一點,我剛剛添加它,它的工作原理感謝 –

+0

在發生錯誤的情況下,它可以幫助驗證所得到的$ TCA。你可以檢查TYPO3真正做了什麼。將這些行添加到擴展的文件tt_content.php的末尾。 'debug($ GLOBALS ['TCA'] ['tt_content'] ['types'],'$ GLOBALS [\'TCA \'] [\'tt_content \'] [\'types \']'); debug($ GLOBALS ['TCA'] ['tt_content'] ['columns'] ['list_type'] ['config'] ['items'],'$ GLOBALS [\'TCA \'] [\'tt_content \ '] [\' 列\ '] [\' LIST_TYPE \ '] [\' 配置\ '] [\' 項目\ ']'); ' –

2

使內ExtensionUtility::registerPlugin()$pluginSignature確保$pluginSignature比賽結果。

這是正在發生的事情是方法:

$extensionName = str_replace(' ', '', ucwords(str_replace('_', ' ', $extensionName))); 
    $pluginSignature = strtolower($extensionName) . '_' . strtolower($pluginName); 

對我來說這看起來不一樣:)

添加$GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';爲劉若英建議也同樣重要。

+0

我注意到'$ extensionName = \ TYPO3 \ CMS \ Core \ Utility \ GeneralUtility :: underscoredToUpperCamelCase($ _ EXTKEY);'。但是,在構建$ pluginSignature的同時建立以下'strtolower()',如果擴展鍵建立在通常的規則上(不包括大寫,無空格),所有這些都會導致相同的結果。 並注意:如果你在/配置/ TCA/... –

+0

感謝常見的'_EXTKEY'分享知識感謝mathias,我是新的typo3所以它會幫助我很多 是的,我想感謝bernd在評論中的知識:) –