Selecting the alternative Template Object

Plugin Options - a FlexForm

The way you select an alternative template is by selecting the template object in the plugin options which are rendered by the standard flexform element for plugins:

img-12

For those interested this form is generated by the “flexform_ds.xml” configuration in the “mininews” extension:

<T3DataStructure>
       <meta>
          <langDisable>1</langDisable>
       </meta>
       <ROOT>
               <type>array</type>
               <el>
                       <field_templateObject>
                               <TCEforms>
                                       <label>LLL:EXT:mininews/locallang_db.php:tt_content.pi_flexform.select_template</label>
                                       <config>
                                               <type>select</type>
                                               <items>
                                                       <n0>
                                                               <n0></n0>
                                                               <n1>0</n1>
                                                       </n0>
                                               </items>
                                               <foreign_table>tx_templavoila_tmplobj</foreign_table>
                                               <foreign_table_where>
                                                        AND tx_templavoila_tmplobj.pid=###STORAGE_PID###
                                                        AND tx_templavoila_tmplobj.datastructure="EXT:mininews/template_datastructure.xml"
                                                        AND tx_templavoila_tmplobj.parent=0
                                                        ORDER BY tx_templavoila_tmplobj.title
                                               </foreign_table_where>
                                               <size>1</size>
                                               <minitems>0</minitems>
                                               <maxitems>1</maxitems>
                                       </config>
                               </TCEforms>
                       </field_templateObject>
               </el>
       </ROOT>
</T3DataStructure>

Further “mininews” enables the configuration by setting these lines in the “ext_tables.php”

$TCA['tt_content']['types']['list']['subtypes_addlist'][$_EXTKEY.'_pi1']='tx_mininews_frontpage_list;;;;1-1-1,pi_flexform';
t3lib_extMgm::addPiFlexFormValue($_EXTKEY.'_pi1', 'FILE:EXT:mininews/flexform_ds.xml');

This is in fact all you have to do to select an alternative template. Of course the question is - what is a Template Object and how to we create one? This is answered next.