Index: class.t3lib_tceforms_suggest.php =================================================================== --- class.t3lib_tceforms_suggest.php (revision 82026) +++ class.t3lib_tceforms_suggest.php (working copy) @@ -63,6 +63,13 @@ $containerCssClass = $this->cssClass . ' ' . $this->cssClass . '-position-right'; $suggestId = 'suggest-' . $table . '-' . $field . '-' . $row['uid']; + + if ('flex' === $GLOBALS['TCA'][$table]['columns'][$field]['config']['type']) { + $fieldPattern = 'data[' . $table . '][' . $row['uid'] . ']['; + $flexformField = str_replace($fieldPattern, '', $fieldname); + $flexformField = substr($flexformField, 0, -1); + $field = str_replace(array(']['), '|', $flexformField); + } $selector = '
@@ -129,12 +136,38 @@ $TSconfig = t3lib_BEfunc::getPagesTSconfig($pageId); $queryTables = array(); $foreign_table_where = ''; - $wizardConfig = $GLOBALS['TCA'][$table]['columns'][$field]['config']['wizards']['suggest']; - if (isset($GLOBALS['TCA'][$table]['columns'][$field]['config']['allowed'])) { - $queryTables = t3lib_div::trimExplode(',', $GLOBALS['TCA'][$table]['columns'][$field]['config']['allowed']); - } elseif (isset($GLOBALS['TCA'][$table]['columns'][$field]['config']['foreign_table'])) { - $queryTables = array($GLOBALS['TCA'][$table]['columns'][$field]['config']['foreign_table']); - $foreign_table_where = $GLOBALS['TCA'][$table]['columns'][$field]['config']['foreign_table_where']; + + $fieldConfig = $GLOBALS['TCA'][$table]['columns'][$field]['config']; + + $parts = explode('|', $field); + if ('flex' === $GLOBALS['TCA'][$table]['columns'][$parts[0]]['config']['type']) { + if (is_array($row) && (0 < count($row))) { + $flexfieldTCAConfig = $GLOBALS['TCA'][$table]['columns'][$parts[0]]['config']; + $flexformDSArray = t3lib_BEfunc::getFlexFormDS($flexfieldTCAConfig, $row, $table); + $flexformDSArray = t3lib_div::resolveAllSheetsInDS($flexformDSArray); + $flexformElement = $parts[count($parts)-2]; + $continue = true; + foreach ($flexformDSArray as $sheet ) { + foreach ($sheet as $sheetId => $dataStructure) { + if (isset($dataStructure['ROOT']['el'][$flexformElement]['TCEforms']['config'])) { + $fieldConfig = $dataStructure['ROOT']['el'][$flexformElement]['TCEforms']['config']; + $continue = false; + break; + } + } + if (!$continue) break; + } + $field = str_replace('|', '][', $field); + } + } + + $wizardConfig = $fieldConfig['wizards']['suggest']; + + if (isset($fieldConfig['allowed'])) { + $queryTables = t3lib_div::trimExplode(',', $fieldConfig['allowed']); + } elseif (isset($fieldConfig['foreign_table'])) { + $queryTables = array($fieldConfig['foreign_table']); + $foreign_table_where = $fieldConfig['foreign_table_where']; // strip ORDER BY clause $foreign_table_where = trim(preg_replace('/ORDER[[:space:]]+BY.*/i', '', $foreign_table_where)); }