错误形式错字3 7.6.2无法正常工作

时间:2016-02-23 05:33:56

标签: php typo3 fluid extbase extension-builder3

我在typo3 7.6.2版本中使用扩展构建器创建了一个扩展。现在我想将flexform添加到扩展名'Products'以获取详细信息页面PID。但我尽力整合flexform,但它没有用。

这是我的代码 -

在ext_tables.php中 -

  \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
        'Wxproducts.' . $_EXTKEY,
        'Wxproducts',
        'Products'
    );

// flexform integration 
$pluginSignature = str_replace('_','','Wxproducts'.$_EXTKEY) . '_products';
$TCA['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
t3lib_extMgm::addPiFlexFormValue($pluginSignature, 'FILE:EXT:' . $_EXTKEY . '/Configuration/FlexForms/flexform_products.xml');

在Configuration / FlexForms / flexform_products.php中 -

<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">Products->list</numIndex>
            </numIndex>

            <numIndex index="1">
             <numIndex index="0">Detail</numIndex>
             <numIndex index="1">Products->show</numIndex>
            </numIndex>

           </items>
         </config>
       </TCEforms>
      </switchableControllerActions>
     </el>
   </ROOT>
  </sDEF>
 </sheets>
</T3DataStructure>

它不起作用。我无法弄清楚问题是什么。任何想法!

提前致谢!

3 个答案:

答案 0 :(得分:4)

您的 $ pluginSignature 变量似乎有误,它上面有供应商名称。请尝试以下代码:

$extensionName = strtolower(\TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY));
$pluginSignature = $extensionName.'_products';    

这是一个来自TYPO3 Extbase书的例子:

$pluginSignature = 'simpleblog_bloglisting';

simpleblog 是扩展程序密钥,博客列表是插件名称。

答案 1 :(得分:0)

在行上的文件ext_tables.php中:

t3lib_extMgm::addPiFlexFormValue

试试这个:

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue

答案 2 :(得分:0)

你可能在pluginSignature中犯了错误,尝试下面的代码可能对你有帮助。

使用v7.6.3

- ext_tables.php

/*** FlexForm ***/
$extensionName = \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY);
$pluginSignature = strtolower($extensionName) . '_products'; 

$TCA['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:'.$_EXTKEY.'/Configuration/FlexForms/FlexForm.xml');
/*** FlexForm ***/

-FlexForm.xml

<T3DataStructure>
<meta>
    <langDisable>1</langDisable>
</meta>
<sheets>
    <sDEF>
        <ROOT>
            <TCEforms>
                <sheetTitle>Settings</sheetTitle>
            </TCEforms>
            <type>array</type>
            <el>
                <!-- View -->
                <switchableControllerActions>
                    <TCEforms>
                    <label>Select Options</label>
                    <onChange>reload</onChange>
                    <config>
                        <type>select</type>
                        <items>
                            <numIndex index="0">
                                <numIndex index="0">...Select Item...</numIndex>                            
                            </numIndex> 
                            <numIndex index="1">
                                <numIndex index="0">Action 1</numIndex>
                                <numIndex index="1">ControllerName->action1;ControllerName->action2</numIndex> <!-- Allow action to FE -->
                            </numIndex>
                            <numIndex index="2">
                                <numIndex index="0">Action 2</numIndex>
                                <numIndex index="1">ControllerName->action3;ControllerName->action4</numIndex> <!-- Allow action to FE -->
                            </numIndex>
                        </items>
                    </config>
                    </TCEforms>
                </switchableControllerActions>

                <settings.formID>
                    <TCEforms>
                        <label>Available Forms</label>
                        <displayCond>FIELD:switchableControllerActions:=:ControllerName->action1;ControllerName->action2</displayCond>
                        <config>
                            <type>select</type>
                            <size>1</size>
                            <minitems>0</minitems>
                            <maxitems>1</maxitems>
                            <itemsProcFunc>TYPO3\VendorName\Controller\ControllerName->flexFormsListItems</itemsProcFunc>
                            <items type="array"></items>
                        </config>
                    </TCEforms>
                </settings.formID>
            </el>
        </ROOT>
    </sDEF>
</sheets>
</T3DataStructure>