Bug #20962 » 0011834.patch
t3lib/class.t3lib_extmgm.php (Arbeitskopie) | ||
---|---|---|
*/
|
||
public static function addFieldsToAllPalettesOfField($table, $field, $addFields, $insertionPosition = '') {
|
||
$generatedPalette = '';
|
||
$processedPalettes = array();
|
||
t3lib_div::loadTCA($table);
|
||
if (isset($GLOBALS['TCA'][$table]['columns'][$field])) {
|
||
... | ... | |
// If the field already has a palette, extend it:
|
||
if ($items[$field]['details']['palette']) {
|
||
$palette = $items[$field]['details']['palette'];
|
||
self::addFieldsToPalette($table, $palette, $addFields, $insertionPosition);
|
||
if (!isset($processedPalettes[$palette])) {
|
||
self::addFieldsToPalette($table, $palette, $addFields, $insertionPosition);
|
||
$processedPalettes[$palette] = true;
|
||
}
|
||
// If there's not palette yet, create one:
|
||
} else {
|
||
if ($generatedPalette) {
|
||
... | ... | |
if ($list && preg_match_all($pattern, $list, $listMatches)) {
|
||
if ($insertionList && preg_match_all($pattern, $insertionList, $insertionListMatches)) {
|
||
$duplicates = array_intersect($listMatches[2], $insertionListMatches[2]);
|
||
if ($duplicates) {
|
||
foreach ($duplicates as &$duplicate) {
|
||
$duplicate = preg_quote($duplicate, '/');
|
||
$insertionItems = array();
|
||
$insertionDuplicates = false;
|
||
foreach ($insertionListMatches[2] as $insertionIndex => $insertionItem) {
|
||
if (!isset($insertionItems[$insertionItem]) && !in_array($insertionItem, $listMatches[2])) {
|
||
$insertionItems[$insertionItem] = true;
|
||
} else {
|
||
unset($insertionListMatches[0][$insertionIndex]);
|
||
$insertionDuplicates = true;
|
||
}
|
||
$insertionList = preg_replace(
|
||
array('/(^|,)\s*\b(' . implode('|', $duplicates) . ')\b[^,]*(,|$)/', '/,$/'),
|
||
array('\3', ''),
|
||
$insertionList
|
||
);
|
||
}
|
||
if ($insertionDuplicates) {
|
||
$insertionList = implode('', $insertionListMatches[0]);
|
||
}
|
||
}
|
||
}
|
||