0011834.patch

Administrator Admin, 2009-08-31 18:33

Download (2.09 KB)

View differences:

t3lib/class.t3lib_extmgm.php (Arbeitskopie)
308 308
	 */
309 309
	public static function addFieldsToAllPalettesOfField($table, $field, $addFields, $insertionPosition = '') {
310 310
		$generatedPalette = '';
311
		$processedPalettes = array();
311 312
		t3lib_div::loadTCA($table);
312 313

  
313 314
		if (isset($GLOBALS['TCA'][$table]['columns'][$field])) {
......
320 321
							// If the field already has a palette, extend it:
321 322
						if ($items[$field]['details']['palette']) {
322 323
							$palette = $items[$field]['details']['palette'];
323
							self::addFieldsToPalette($table, $palette, $addFields, $insertionPosition);
324
							if (!isset($processedPalettes[$palette])) {
325
								self::addFieldsToPalette($table, $palette, $addFields, $insertionPosition);
326
								$processedPalettes[$palette] = true;
327
							}
324 328
							// If there's not palette yet, create one:
325 329
						} else {
326 330
							if ($generatedPalette) {
......
450 454

  
451 455
		if ($list && preg_match_all($pattern, $list, $listMatches)) {
452 456
			if ($insertionList && preg_match_all($pattern, $insertionList, $insertionListMatches)) {
453
				$duplicates = array_intersect($listMatches[2], $insertionListMatches[2]);
454
				if ($duplicates) {
455
					foreach ($duplicates as &$duplicate) {
456
						$duplicate = preg_quote($duplicate, '/');
457
				$insertionItems = array();
458
				$insertionDuplicates = false;
459

  
460
				foreach ($insertionListMatches[2] as $insertionIndex => $insertionItem) {
461
					if (!isset($insertionItems[$insertionItem]) && !in_array($insertionItem, $listMatches[2])) {
462
						$insertionItems[$insertionItem] = true;
463
					} else {
464
						unset($insertionListMatches[0][$insertionIndex]);
465
						$insertionDuplicates = true;
457 466
					}
458
					$insertionList = preg_replace(
459
						array('/(^|,)\s*\b(' . implode('|', $duplicates) . ')\b[^,]*(,|$)/', '/,$/'),
460
						array('\3', ''),
461
						$insertionList
462
					);
463 467
				}
468

  
469
				if ($insertionDuplicates) {
470
					$insertionList = implode('', $insertionListMatches[0]);
471
				}
464 472
			}
465 473
		}
466 474