4

我在typo3 7.6.2 版本中使用扩展生成器创建了一个扩展。现在我想将 flexform 添加到扩展“产品”以获取详细信息页面 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>

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

提前致谢!

4

3 回答 3

4

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

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

以下是 TYPO3 Extbase 书中的示例:

$pluginSignature = 'simpleblog_bloglisting';

simpleblog是扩展键,bloglisting是插件名称。

于 2016-02-24T16:40:01.487 回答
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>
于 2016-02-27T07:33:56.373 回答
0

在文件 ext_tables.php 中:

t3lib_extMgm::addPiFlexFormValue

尝试使用这个:

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue
于 2016-02-24T08:55:23.263 回答