TYPO3 7.6.2中的Flexform无法正常工作

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>

它不起作用。我无法弄清楚问题出在哪里。有什么想法吗!

先行致谢!


我认为这会对你有所帮助: https://stackoverflow.com/questions/28219192/typo3-add-flexform-to-my-own-extension/34349357#34349357 - Vishal Tanna
3个回答

4

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

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

以下内容摘自TYPO3 Extbase书籍,提供一个示例:

$pluginSignature = 'simpleblog_bloglisting';

simpleblog 是扩展键(extension key),bloglisting 是插件名称(plugin name)。


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>

0

在文件 ext_tables.php 的行:

t3lib_extMgm::addPiFlexFormValue

尝试使用这个:

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

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接