Bug #17255 » 0005514.patch
t3lib/class.t3lib_tceforms_inline.php (Arbeitskopie) | ||
---|---|---|
* @param array $config: content of $PA['fieldConf']['config']
|
||
* @return string A HTML string with <table> tag around.
|
||
*/
|
||
function renderCombinationTable(&$rec, $appendFormFieldNames, $config = array()) {
|
||
function renderCombinationTable($rec, $appendFormFieldNames, $config = array()) {
|
||
$foreign_table = $config['foreign_table'];
|
||
$foreign_selector = $config['foreign_selector'];
|
||
if ($foreign_selector && $config['appearance']['useCombination']) {
|
||
$comboConfig = $GLOBALS['TCA'][$foreign_table]['columns'][$foreign_selector]['config'];
|
||
$comboTable = $this->getPossibleRecordsSelectorTable($comboConfig);
|
||
$comboRecord = array();
|
||
// Fetch only the uid if the type is group/db (e.g. tx_myext_table_123):
|
||
if (strstr($rec[$foreign_selector], '_') !== false) {
|
||
$parts = t3lib_div::revExplode('_', $rec[$foreign_selector], 2);
|
||
$rec[$foreign_selector] = $parts[1];
|
||
}
|
||
// record does already exist, so load it
|
||
if (t3lib_div::testInt($rec[$foreign_selector])) {
|
||
$comboRecord = $this->getRecord(
|
||
$this->inlineFirstPid,
|
||
$comboConfig['foreign_table'],
|
||
$comboTable,
|
||
$rec[$foreign_selector]
|
||
);
|
||
$isNewRecord = false;
|
||
... | ... | |
} else {
|
||
$comboRecord = $this->getNewRecord(
|
||
$this->inlineFirstPid,
|
||
$comboConfig['foreign_table']
|
||
$comboTable
|
||
);
|
||
$isNewRecord = true;
|
||
}
|
||
// get the TCEforms interpretation of the TCA of the child table
|
||
$out = $this->fObj->getMainFields($comboConfig['foreign_table'], $comboRecord);
|
||
$out = $this->fObj->getMainFields($comboTable, $comboRecord);
|
||
$out = $this->wrapFormsSection($out, array(), array('class' => 'wrapperAttention'));
|
||
// if this is a new record, add a pid value to store this record and the pointer value for the intermediate table
|
||
if ($isNewRecord) {
|
||
$comboFormFieldName = $this->prependFormFieldNames.'['.$comboConfig['foreign_table'].']['.$comboRecord['uid'].'][pid]';
|
||
$comboFormFieldName = $this->prependFormFieldNames.'['.$comboTable.']['.$comboRecord['uid'].'][pid]';
|
||
$out .= '<input type="hidden" name="'.$comboFormFieldName.'" value="'.$this->inlineFirstPid.'"/>';
|
||
}
|
||
... | ... | |
/**
|
||
* Determine the type of a record selector, e.g. select or group/db.
|
||
*
|
||
* @param array $config: TCE configuration of the selector
|
||
* @return mixed The type of the selector, 'select' or 'groupdb' - false not valid
|
||
* @param array $config: TCA configuration of the selector
|
||
* @return mixed The type of the selector, 'select' or 'groupdb' - false if not valid
|
||
*/
|
||
function getPossibleRecordsSelectorType($config) {
|
||
$type = false;
|
||
... | ... | |
}
|
||
return $type;
|
||
}
|
||
|
||
|
||
/**
|
||
* Determine the child table of a record selector.
|
||
*
|
||
* @param array $config: TCA configuration of the selector
|
||
* @return mixed The child table of the selector - false if not valid
|
||
*/
|
||
function getPossibleRecordsSelectorTable($config) {
|
||
$table = false;
|
||
if ($config['type'] == 'select') {
|
||
$table = $config['foreign_table'];
|
||
} elseif ($config['type'] == 'group' && $config['internal_type'] == 'db') {
|
||
$table = $config['allowed'];
|
||
}
|
||
return $table;
|
||
}
|
||
/**
|
||
* Check, if a field should be skipped, that was defined to be handled as foreign_field or foreign_sortby of
|
||
* the parent record of the "inline"-type - if so, we have to skip this field - the rendering is done via "inline" as hidden field
|
||
*
|