* Implement option to use two ds_pointerFields so DataStructures can be switched by the combination of two field's values
* Enabled the new ds_pointerFields possibility for tt_content.pi_flexform, so you can specify DataStructures per (combination of) list_type and CType values
* Made css_styled_content register the DataStructures for the CType=table Content Element using the new ds_pointerFields instead of overriding the 'default' DS key
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2760
709f56b5-9817-0410-a4d7-
c38de5d9e867
+2007-11-24 Ingmar Schlecht <ingmar@typo3.org>
+
+ * Feature #6770: Flexform DataStructure pointerFields:
+ * Implement option to use two ds_pointerFields so DataStructures can be switched by the combination of two field's values
+ * Enabled the new ds_pointerFields possibility for tt_content.pi_flexform, so you can specify DataStructures per (combination of) list_type and CType values
+ * Made css_styled_content register the DataStructures for the CType=table Content Element using the new ds_pointerFields instead of overriding the 'default' DS key
+
2007-11-23 Ernesto Baschny <ernst@cron-it.de>
* Added feature #5791: indexed_search: join_pages is now configurable via TypoScript
if (is_array($ds_array)) { // If there is a data source array, that takes precedence
// If a pointer field is set, take the value from that field in the $row array and use as key.
if ($ds_pointerField) {
- $srcPointer = $row[$ds_pointerField];
+
+ // Up to two pointer fields can be specified in a comma separated list.
+ $pointerFields = t3lib_div::trimExplode(',', $ds_pointerField);
+ if(count($pointerFields) == 2) { // If we have two pointer fields, the array keys should contain both field values separated by comma. The asterisk "*" catches all values. For backwards compatibility, it's also possible to specify only the value of the first defined ds_pointerField.
+ if($ds_array[$row[$pointerFields[0]].','.$row[$pointerFields[1]]]) { // Check if we have a DS for the combination of both pointer fields values
+ $srcPointer = $row[$pointerFields[0]].','.$row[$pointerFields[1]];
+ } elseif($ds_array[$row[$pointerFields[1]].',*']) { // Check if we have a DS for the value of the first pointer field suffixed with ",*"
+ $srcPointer = $row[$pointerFields[1]].',*';
+ } elseif($ds_array['*,'.$row[$pointerFields[1]]]) { // Check if we have a DS for the value of the second pointer field prefixed with "*,"
+ $srcPointer = '*,'.$row[$pointerFields[1]];
+ } elseif($ds_array[$row[$pointerFields[0]]]) { // Check if we have a DS for just the value of the first pointer field (mainly for backwards compatibility)
+ $srcPointer = $row[$pointerFields[0]];
+ }
+ } else {
+ $srcPointer = $row[$pointerFields[0]];
+ }
+
$srcPointer = isset($ds_array[$srcPointer]) ? $srcPointer : 'default';
} else $srcPointer='default';
/**
* Adds an entry to the "ds" array of the tt_content field "pi_flexform".
- * This is used by plugins to add a flexform XML reference / content for use when they are selected as plugin.
+ * This is used by plugins to add a flexform XML reference / content for use when they are selected as plugin or content element.
* Usage: 0
*
- * @param string The same value as the key for the plugin
+ * @param string Plugin key as used in the list_type field. Use the asterisk * to match all list_type values.
* @param string Either a reference to a flex-form XML file (eg. "FILE:EXT:newloginbox/flexform_ds.xml") or the XML directly.
+ * @param string Value of tt_content.CType (Content Type) to match. The default is "list" which corresponds to the "Insert Plugin" content element. Use the asterisk * to match all CType values.
* @return void
* @see addPlugin()
*/
- function addPiFlexFormValue($piKeyToMatch,$value) {
+ function addPiFlexFormValue($piKeyToMatch, $value, $CTypeToMatch='list') {
global $TCA;
t3lib_div::loadTCA('tt_content');
if (is_array($TCA['tt_content']['columns']) && is_array($TCA['tt_content']['columns']['pi_flexform']['config']['ds'])) {
- $TCA['tt_content']['columns']['pi_flexform']['config']['ds'][$piKeyToMatch] = $value;
+ $TCA['tt_content']['columns']['pi_flexform']['config']['ds'][$piKeyToMatch.','.$CTypeToMatch] = $value;
}
}
'label' => 'LLL:EXT:cms/locallang_ttc.php:pi_flexform',
'config' => Array (
'type' => 'flex',
- 'ds_pointerField' => 'list_type',
+ 'ds_pointerField' => 'list_type,CType',
'ds' => array(
'default' => '
<T3DataStructure>
if (!defined ('TYPO3_MODE')) die ('Access denied.');
// add flexform
-t3lib_extMgm::addPiFlexFormValue('default', 'FILE:EXT:css_styled_content/flexform_ds.xml');
+t3lib_extMgm::addPiFlexFormValue('*', 'FILE:EXT:css_styled_content/flexform_ds.xml','table');
t3lib_extMgm::addToAllTCAtypes('tt_content','pi_flexform;;;;1-1-1','table');
t3lib_extMgm::addStaticFile($_EXTKEY,'static/','CSS Styled Content');