protected static function generatePalette($table, array $paletteFields = array(), array $standardFields = array())
	{
		$palette = '';

		if ($table === 'tl_module') {
			$palette .= '{title_legend},name';
			if (in_array('headline', $standardFields)) {
				$palette .= ',headline';
			}
			$palette .= ',type';
		}
		else {
			$palette .= '{type_legend},type';
			if ($table === 'tl_content' && in_array('headline', $standardFields)) {
				$palette .= ',headline';
			}
			if (in_array('columns', $standardFields)) {
				$palette .= ';{rs_columns_legend},rs_columns_large,rs_columns_medium,rs_columns_small';
			}
			if (in_array('text', $standardFields)) {
				$palette .= ';{text_legend},text';
			}
		}

		if (
			isset($paletteFields[0])
			&& $paletteFields[0] !== 'rsce_data'
			&& isset($GLOBALS['TL_DCA'][$table]['fields'][$paletteFields[0]]['inputType'])
			&& $GLOBALS['TL_DCA'][$table]['fields'][$paletteFields[0]]['inputType'] !== 'rsce_group_start'
			&& $GLOBALS['TL_DCA'][$table]['fields'][$paletteFields[0]]['inputType'] !== 'rsce_list_start'
		) {
			$palette .= ';{rsce_legend}';
		}

		$palette .= ',' . implode(',', $paletteFields);

		if ($table === 'tl_content' && in_array('image', $standardFields)) {
			$palette .= ';{image_legend},addImage';
		}

		if ($table === 'tl_form_field') {
			$palette .= ';{expert_legend:hide},class';
		}

		$palette .= ';{template_legend:hide},customTpl';

		if ($table !== 'tl_form_field') {

			$palette .= ';{protected_legend:hide},protected;{expert_legend:hide},guests';

			if (in_array('cssID', $standardFields)) {
				$palette .= ',cssID';
			}

		}

		if ($table === 'tl_content') {
			$palette .= ';{invisible_legend:hide},invisible,start,stop';
		}

		return $palette;
	}