[TYPO3] Re: [Typo3] how to build a flexform pull down list?

christian oettinger christian.oettinger at gmx.de
Sat Mar 4 18:55:43 CET 2006


thank you so much for answering to yourself after you found out.
I was stuck on the same thing!!


greetings from munich!

oe



Joe Kralicky wrote:
> Hi,
> 
> I seem to have found out how to create a pull-down list by looking in 
> code from "danp_documentdirs".  For anyone else interested here's how 
> you do it: (in the example below, I am creating a pull-down menu for 
> setting a "plugin mode" for my plugin)
> 
> * locate the following line inside your ext_tables.php file *
> t3lib_div::loadTCA("tt_content");
> 
> *Add the next 2 lines after it*
> $TCA['tt_content']['types']['list']['subtypes_addlist'][$_EXTKEY.'_pi1']='pi_flexform'; 
> 
> t3lib_extMgm::addPiFlexFormValue($_EXTKEY.'_pi1','FILE:EXT:<your_ext_id>/flexform_ds.xml'); 
> 
> 
> *Create the xml file mentioned above: <extension dir>/flexform_ds.xml*
> 
> Here's the xml code for flexform_ds.xml to create the list:
> 
> <T3DataStructure>
>           <ROOT>
>             <type>array</type>
>             <el>
>               <field_pluginMode> // make this tag unique and descriptive
>                         <TCEforms>
>                                 <label>label for pull-down list</label>
>                                 <config>
>                                      <type>select</type>
>                                      <items>
>                                         <n0>
>                                             <n0>label for first 
> selection</n0>
>                                             <n1>0</n1> // 0 = value of 
> selection available for retrieval in code
>                                         </n0>
>                                         <n1>
>                                             <n0>label for 2nd 
> selection</n0>
>                                             <n1>1</n1> // 1 = value of 
> selection available for retrieval in code
>                                         </n1>
>                                      </items>
>                                      <size>1</size>
>                                      <minitems>0</minitems>
>                                      <maxitems>1</maxitems>
> 
>                                 </config>
>                         </TCEforms>
>               </field_pluginMode>
>             </el>
>           </ROOT>
> </T3DataStructure>
> 
> 
> *To retrieve the selected value in the code*
> $this->pi_initPIflexForm(); // initialize - or else you can't get the 
> data 
> $this->plugin_mode=$this->pi_getFFvalue($this->cObj->data['pi_flexform'],'field_pluginMode'); 
> // notice the 'field_pluginMode' is the same as the tag in the xml file.
> 
> ...and there you have it.
> 
> Best regards,
> 
> Joe Kralicky
> 
> 
> Joe Kralicky wrote:
> 
>> Hi List,
>>
>> I've scoured the Core APIs document to find info on building a 
>> flexform pull-down list but the example shows getting data from a 
>> database call and I just want a list with 2 text entries.  Can someone 
>> help me out and maybe explain it or point me to a reference?
>> Here's what I have...
>>
>> <T3DataStructure>
>>      <ROOT>
>>        <type>array</type>
>>        <el>
>>          <field_templateObject>
>>                    <TCEforms>
>>                       <label>My list label</label>
>>                       <config>
>>                          <type>select</type>
>>                          <items>
>>                              <numIndex index="0"> item 0 </numIndex>
>>                              <numIndex index="1"> item 1 </numIndex>
>>                          </items>
>>                        </config>
>>                    </TCEforms>
>>          </field_templateObject>
>>        </el>
>>      </ROOT>
>> </T3DataStructure>
>>
>>
>> Thank you very much!
>>
>> Joe Kralicky



More information about the TYPO3-english mailing list