Flexform in typo3 7.6.2 not working

4.8k views Asked by At

I have created a extension using extension builder in typo3 7.6.2 version. Now I would like to add flexform to extension 'Products' for detail page PID. But I tried my best to integrate flexform but it did not work.

Here is my code -

In 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');

In 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>

Its not working. I am unable to figure out whats the problem. Any idea!

Thanks in Advance!

3

There are 3 answers

0
José Ricardo Júnior On

Your $pluginSignature variable seems to be wrong, it has the vendor name on it. Try the following code:

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

Here's an example taken from TYPO3 Extbase book:

$pluginSignature = 'simpleblog_bloglisting';

simpleblog is the extension key, and bloglisting is the plugin name.

0
Robert G. On

In a file ext_tables.php on line:

t3lib_extMgm::addPiFlexFormValue

try use this:

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue
0
Ghanshyam Gohel On

Might you did mistake in pluginSignature, try below code might helps you.

Working with 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>