Ajouter un flexform à un plugin
17/01/09
Le flexform est un outil très pratique car il vous permet de configurer votre plugin en backend pour chaque instance de celui-ci. De plus, sa mise en place est simple et les possibilités quasi illimités.
Pour le mettre en place, rendez-vous dans un premier temps dans le fichier « typo3conf/ext/mon_extension/ext_tables.php » (placez le code à la fin du fichier; juste avant le IF final) :
... //Ajout du flexform pour le pi1 - begin $TCA["tt_content"]["types"]["list"]["subtypes_addlist"][$_EXTKEY."_pi1"]="pi_flexform"; t3lib_extMgm::addPiFlexFormValue($_EXTKEY.'_pi1', 'FILE:EXT:'.$_EXTKEY.'/flexform_ds_pi1.xml'); //Ajout du flexform pour le pi1 - end if (TYPO3_MODE=="BE") ...
Suite à cela, créer le fichier dans le répertoire correspondant (dans notre cas le fichier $_EXTKEY.’/flexform_ds_pi1.xml’).
<T3DataStructure> <meta> <langDisable>1</langDisable> </meta> <sheets> <sDEF> <ROOT> <TCEforms> <sheetTitle>Display configuration</sheetTitle> </TCEforms> <type>array</type> <el> <dam_category> <TCEforms> <label>Dam category</label> <config> <type>select</type> <foreign_table>tx_dam_cat</foreign_table> <foreign_table_where>AND tx_dam_cat.deleted=0 AND tx_dam_cat.hidden=0 ORDER BY tx_dam_cat.title </foreign_table_where> <size>1</size> <minitems>1</minitems> <maxitems>1</maxitems> </config> </TCEforms> </dam_category> <results_limit> <TCEforms> <label>Limit of records per page</label> <config> <type>input</type> <size>30</size> </config> </TCEforms> </results_limit> </el> </ROOT> </sDEF> </sheets> </T3DataStructure>
Pour la syntaxe des tags utilisés dans le fichier flexform, reportez vous au wiki typo3 (http://wiki.typo3.org/index.php/Extension_Development,_using_Flexforms).
Article(s) sur le même sujet :



19 janvier 2009 - 16 h 20 min
merci pour ce nouveau blog fort intéressant.
Mes encouragements