92 $this->currentTable = $tableName;
93 $this->currentRow = $row;
95 if (count($fieldNameArray) > 0) {
111 if (!empty($fieldCtrlConfig[
'languageField']) && isset($this->currentRow[$fieldCtrlConfig[
'languageField']])) {
112 $this->originalLanguageUid = (int)$this->currentRow[$fieldCtrlConfig[
'languageField']];
114 $this->originalLanguageUid = FALSE;
128 foreach ($fieldNameArray as $fieldName) {
131 if (!array_key_exists($fieldName, $this->currentRow)) {
136 $value = $this->currentRow[$fieldName];
142 if ($this->currentRow === FALSE) {
147 if ((empty($value) || $this->forceAlternativeFieldValueUse) && !empty($this->alternativeFieldValue)) {
164 $possibleUids = array();
166 switch ($fieldConfig[
'type']) {
179 if (count($possibleUids) === 1) {
180 $relatedRow = $this->getRecordRow($possibleUids[0]);
181 } elseif (count($possibleUids) > 1) {
196 $relatedUids = array();
199 if (($fieldConfig[
'internal_type'] !==
'db') || ($allowedTable === FALSE)) {
204 foreach ($values as $groupValue) {
208 if (!empty($recordForeignTable) && ($recordForeignTable !== $allowedTable)) {
211 if (!empty($foreignTitle)) {
212 $this->alternativeFieldValue = rawurldecode($foreignTitle);
214 $relatedUids[] = $foreignUid;
217 if (count($relatedUids) > 0) {
218 $this->currentTable = $allowedTable;
237 $relatedUids = array();
239 $isTraversable = FALSE;
240 if (isset($fieldConfig[
'foreign_table'])) {
241 $isTraversable = TRUE;
243 $fieldConfig[
'foreign_table_where'] .=
' AND ' . $fieldConfig[
'foreign_table'] .
'.uid IN (' . $value .
')';
247 $PA[
'fieldConf'][
'config'] = $fieldConfig;
248 $PA[
'fieldConf'][
'config'][
'form_type'] = $PA[
'fieldConf'][
'config'][
'form_type'] ? $PA[
'fieldConf'][
'config'][
'form_type'] : $PA[
'fieldConf'][
'config'][
'type'];
249 $PA[
'fieldTSConfig'] = $this->formEngine->setTSconfig($this->currentTable, $this->currentRow, $fieldName);
250 $PA[
'fieldConf'][
'config'] = $this->formEngine->overrideFieldConf($PA[
'fieldConf'][
'config'], $PA[
'fieldTSConfig']);
251 $selectItemArray = $this->formEngine->getSelectItems($this->currentTable, $fieldName, $this->currentRow, $PA);
253 if ($isTraversable && count($selectItemArray)) {
254 $this->currentTable = $fieldConfig[
'foreign_table'];
258 if (count($selectedLabels) === 1) {
259 $this->alternativeFieldValue = $selectedLabels[0];
260 $this->forceAlternativeFieldValueUse = TRUE;
278 $selectedValues = array();
280 if ($maxItems !== NULL && (count($values) > (
int)$maxItems)) {
281 return $selectedValues;
284 foreach ($selectItemArray as $selectItem) {
285 $selectItemValue = $selectItem[1];
286 if (in_array($selectItemValue, $values)) {
288 $selectedValues[] = $selectItem[0];
290 $selectedValues[] = $selectItemValue;
295 return $selectedValues;
308 $relatedUids = array();
310 $PA = array(
'itemFormElValue' => $value);
311 $items = $this->formEngine->inline->getRelatedRecords($this->currentTable, $fieldName, $this->currentRow, $PA, $fieldConfig);
312 if ($items[
'count'] > 0) {
313 $this->currentTable = $fieldConfig[
'foreign_table'];
314 foreach ($items[
'records'] as $inlineRecord) {
315 $relatedUids[] = $inlineRecord[
'uid'];
332 $allowedTable = FALSE;
335 if (count($allowedTables) === 1) {
336 $allowedTable = $allowedTables[0];
339 return $allowedTable;
350 protected function getRecordRow(
$uid) {
353 $dataPreprocessor->fetchRecord($this->currentTable,
$uid,
'');
354 return reset($dataPreprocessor->regTableItems_data);
369 if ($this->originalLanguageUid === FALSE) {
374 if (empty($fieldCtrlConfig[
'languageField'])) {
378 $languageField = $fieldCtrlConfig[
'languageField'];
379 $foundRows = array();
380 foreach ($relatedUids as $relatedUid) {
385 if ((
int)
$currentRow[$languageField] === $this->originalLanguageUid) {
391 if (count($foundRows) === 1) {
392 $relatedRow = $foundRows[0];
static makeInstance($className)
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static splitTable_Uid($str)