in der Datei 'ext_tables.php' werden zwei Zeilen am Ende angehängt:

 

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

 

 

Dementsprechend muss eine Datei 'ff_data_pi1.xml' angelegt werden, die in der einfachen Form etwa so aussieht:

 

<T3DataStructure>
<meta type="array">
<langChildren>0</langChildren>
<langDisable>1</langDisable>
</meta>
<ROOT>
<type>array</type>
<el>
<feld1>
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:[$_EXTKEY]/locallang.xml:label_feld1</label>
<config>
<type>input</type>
</config>
</TCEforms>
</feld1>
<feld2>
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:[$_EXTKEY]/locallang.xml:label_feld2</label>
<config>
<type>input</type>
</config>
</TCEforms>
</feld2>
</el>
</ROOT>
</T3DataStructure>

 

für mehrere Tab-Reiter so:

 

<T3DataStructure>
<sheets>
<Bereich1>
<ROOT>
<type>array</type>
<el>
<feld1>
<TCEforms>
<exclude>1</exclude>
<label>Flexform-Feld 1</label>
<config>
<type>input</type>
</config>
</TCEforms>
</feld1>
<feld2>
<TCEforms>
<exclude>1</exclude>
<label>Flexform-Feld 2</label>
<config>
<type>input</type>
</config>
</TCEforms>
</feld2>
</el>
</ROOT>
</Bereich1>
<Bereich2>
<ROOT>
<type>array</type>
<el>
<feld3>
<TCEforms>
<exclude>1</exclude>
<label>Flexform-Feld 3</label>
<config>
<type>input</type>
</config>
</TCEforms>
</feld3>
<feld4>
<TCEforms>
<exclude>1</exclude>
<label>Flexform-Feld 4</label>
<config>
<type>input</type>
</config>
</TCEforms>
</feld4>
</el>
</ROOT>
</Bereich2>
</sheets>
</T3DataStructure>

 

 

Das einfache Beispiel benutzt die Datei 'locallang.xml' um im BE sprachspezifische Label zu zeigen. Dafür müssen in der Datei 'locallang.xml' entsprechende für jede zu unterstützende Sprache Werte eingetragen sein:

 

	<label index="label_feld1">Flexform-Feld 1</label>
<label index="label_feld2">Flexform-Feld 2</label>

 

 

Die Datentypen der Felder (im Tag <config> definiert) entsprechen der TCA-Definition, nur eben in XML-Notation.

 

Im Plugin selber benutzt man folgende Anweisungen um auf die FlexForm-Inhalte zuzugreifen:

 

$this->pi_initPIflexform(); 
$feld = 'feld1'; // entsprechend obiger Definition
$bereich = 'sDEF'; // sofern nicht anders angegeben
$wert = $this->getConfValue($bereich, $feld, $defaultvalue);

function getConfValue($bereich, $feld, $defaultValue) {
$retval = $this->pi_getFFvalue($this->cObj->data['pi_flexform'],$feld,$bereich);
if (!$retval) { $retval = $this->conf[$feld]; }
if (!$retval) { $retval = $defaultValue; }
return $retval;
}

 

 

Hier noch einige Beispiel-Deklarationen für gängige Feldtypen (nur der <config>-Teil):

 

<type>input</type>
<size>10</size>
<max>20</max>
<eval>trim</eval>

<type>input</type>
<size>8</size>
<max>16</max>
<eval>date</eval>
<checkbox>1</checkbox>

<type>text</type>
<cols>40</cols>
<rows>10</rows>
<wrap>off</wrap>

<config>
<type>text</type>
<cols>40</cols>
<rows>10</rows>
<wrap>virtual</wrap>
</config>
<defaultExtras>
richtext[*]:rte_transform[mode=ts_css]
</defaultExtras>

<type>check</type>
<type>check</type>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">Checkbox 1</numIndex>
</numIndex>
<numIndex index="1" type="array">
<numIndex index="0">Checkbox 2</numIndex>
</numIndex>
</items>
<default>3</default>
(bitweise, daher der defaultwert 3 für beide Checkboxen )

<type>radio</type>
<items type="array">
<numIndex index="0" type="array">
<numIndex index="0">Radiobox 1</numIndex>
<numIndex index="1">Radiowert1</numIndex>
</numIndex>
<numIndex index="1" type="array">
<numIndex index="0">Radiobox 2</numIndex>
<numIndex index="1">Radiowert2</numIndex>
</numIndex>
</items>

<type>group</type>
<internal_type>db</internal_type>
<allowed>--Tabellenname--</allowed>
<size>6</size>
<minitems>1</minitems>
<maxitems>10</maxitems>

<type>group</type>
<internal_type>file_reference</internal_type>
<allowed>jpg,gif,png</allowed>
<max_size>2000</max_size>
<uploadfolder>uploads/--extname--</uploadfolder>
<show_thumbs>1</show_thumbs>
<size>3</size>
<minitems>0</minitems>
<maxitems>3</maxitems>


<type>input</type>
<eval>trim</eval>
<wizards type="array">
<_PADDING>2</_PADDING>
<link type="array">
<type>popup</type>
<title>Link</title>
<icon>link_popup.gif</icon>
<script>browse_links.php?mode=wizard&amp;act=file</script>
<params type="array">
<blindLinkOptions>page,url,mail,spec</blindLinkOptions>
</params>
<JSopenParams>height=300,width=500,status=0,menubar=0,scrollbars=1</JSopenParams>
</link>
</wizards>

Color-Selector (ungetestet)
<type>input</type>
<size>6</size>
<wizards>
<color>
<type>colorbox</type>
<dim>212x18</dim>
<tableStyle>border:solid 1px black;</tableStyle>
<script>wizard_colorpicker.php</script>
<JSopenParams>height=340,width=360,status=0,menubar=0,scrollbars=1</JSopenParams>
</color>
</wizards>
<default></default>
<eval>#555555</eval>

Mit extbase-Extension und (TYPO3 6.1) sieht das Ganze etwas anders aus:

 

'ext_tables.php':

 

\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin(
$_EXTKEY,
'pikey',
'PlugIn Name'
);
$extensionName = strtolower(\TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($_EXTKEY));
$pluginName = strtolower('pikey');
$pluginSignature = $extensionName.'_'.$pluginName;
$TCA['tt_content']['types']['list']['subtypes_excludelist'][$pluginSignature] = 'layout,select_key,pages';
$TCA['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform';
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue($pluginSignature, 'FILE:EXT:'.$_EXTKEY . '/Configuration/FlexForms/PluginName.xml');

 

 

Dementsprechend muss eine Datei '/Configuration/FlexForms/PluginName.xml' angelegt werden, die in der einfachen Form etwa so aussieht:

 

<T3DataStructure>
<meta type="array">
<langChildren>0</langChildren>
<langDisable>1</langDisable>
</meta>
<ROOT>
<type>array</type>
<el>
<settings.feld1>
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:[$_EXTKEY]/Resources/Private/Language/locallang.xlf:label_feld1</label>
<config>
<type>input</type>
</config>
</TCEforms>
</settings.feld1>
<settings.feld2>
<TCEforms>
<exclude>1</exclude>
<label>LLL:EXT:[$_EXTKEY]/Resources/Private/Language/locallang.xlf:label_feld2</label>
<config>
<type>input</type>
</config>
</TCEforms>
</settings.feld2>
</el>
</ROOT>
</T3DataStructure>

 

 

Die Sprachdateien haben auch ihr zugewiesenes Verzeichnis und sind jetzt XLF statt XML:

 

	<trans-unit id="label_settings_feld1">
<source>Flexform-Feld 1</source>
</trans-unit>
<trans-unit id="label_settings_feld2">
<source>Flexform-Feld 2</source>
</trans-unit>

 

 

Die Datentypen der Felder (im Tag <config> definiert) entsprechen der TCA-Definition, nur eben in XML-Notation.

 

Im Plugin selber benutzt man folgende Anweisungen um auf die FlexForm-Inhalte zuzugreifen:

 

$this->pi_initPIflexform(); 
$feld = 'feld1'; // entsprechend obiger Definition
$bereich = 'sDEF'; // sofern nicht anders angegeben
$wert = $this->getConfValue($bereich, $feld, $defaultvalue);

function getConfValue($bereich, $feld, $defaultValue) {
$retval = $this->pi_getFFvalue($this->cObj->data['pi_flexform'],$feld,$bereich);
if (!$retval) { $retval = $this->conf[$feld]; }
if (!$retval) { $retval = $defaultValue; }
return $retval;
}

 

 

Hier noch die neuen Datei-Referenzen mittels FAL (nach Referenz):

 

<maxitems>1</maxitems <type>inline</type> <foreign_table>sys_file_reference</foreign_table> <foreign_field>uid_foreign</foreign_field> <foreign_sortby>sorting_foreign</foreign_sortby> <foreign_table_field>tablenames</foreign_table_field> <foreign_match_fields> <fieldname>--feldname--</fieldname> </foreign_match_fields> <foreign_label>uid_local</foreign_label> <foreign_selector>uid_local</foreign_selector> <foreign_selector_fieldTcaOverride> 	<config> 		<appearance> 	 		<elementBrowserType>file</elementBrowserType> 	 		<elementBrowserAllowed>gif,jpg,jpeg,tif,tiff,bmp,pcx,tga,png,pdf,ai</elementBrowserAllowed> <!-- $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] --> 		</appearance> 	</config> </foreign_selector_fieldTcaOverride> <filter> 	<0> 		<userFunc>TYPO3\CMS\Core\Resource\Filter\FileExtensionFilter->filterInlineChildren</userFunc> 	<parameters> 	<allowedFileExtensions>$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']</allowedFileExtensions> 	<disallowedFileExtensions></disallowedFileExtensions> 		</parameters> 	</0> </filter> <appearance>(...)</appearance>

<type>group</type>
<internal_type>db</internal_type>
<appearance>
<elementBrowserType>file</elementBrowserType>
<elementBrowserAllowed>jpg,jpeg,png,gif</elementBrowserAllowed>
</appearance>
<allowed>sys_file</allowed>
<size>5</size>
<minitems>0</minitems>
<maxitems>5</maxitems>
<show_thumbs>1</show_thumbs>

 

 

 

'config' => array( 
'maxitems' => 1,
'type' => 'inline',
'foreign_table' => 'sys_file_reference',
'foreign_field' => 'uid_foreign',
'foreign_sortby' => 'sorting_foreign',
'foreign_table_field' => 'tablenames',
'foreign_match_fields' => array( 'fieldname' => '--fieldname--' ),
'foreign_label' => 'uid_local',
'foreign_selector' => 'uid_local',
'foreign_selector_fieldTcaOverride' => array(
'config' => array(
'appearance' => array(
'elementBrowserType' => 'file',
'elementBrowserAllowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
)
)
),
'filter' => array(
array(
'userFunc' => 'TYPO3\\CMS\\Core\\Resource\\Filter\\FileExtensionFilter->filterInlineChildren',
'parameters' => array(
'allowedFileExtensions' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
'disallowedFileExtensions' => ''
)
)
),
'appearance' => array(...),
:
);

 

 

 

 
Ihre aktuelle Seitenauswahl:  
>>>