Zum Inhalt springen

feld hinzufügen

Erstellt am 13. Mai 2008 · 3 Antworten · letzte Antwort am 13. Mai 2008

Tags: TCA, Frage

ran2 ·

Hallo zusammen,

wollte in einer extension im backend ein formfield dazu basteln, hab dann per phpmyadmin das neue feld angelegt und suche jetzt die datei wo ich dieses neue ding eintragen muss, dann mit das neue feld im backend zu sehen ist bzw wo ich den marker eintragen muss damit der inhalt meines neuen feldes auch im frontend gezeigt wird.

Handelte sich übrigens um pb_survey falls das weiterhilft.

thx schonmal.

Desmond ·

In "ext_tables.sql" trägst du das neue Feld ein (Musst also nicht über phpMyAdmin).

In "ext_tables.php" konfigurierst du das Feld. Habe gerade kein BE Extension zur Hand. Musst schauen wo es allen Orten eingetragen werden muss. Meistens gibt es noch so Liste wo alle Formular Felder aufgezählt werden.

In "locallang_db.xml" kommt der Name rein (der Pfad wird in "ext_tables.php" definiert).

ran2 ·

Hallo Desmond,

vielen Dank! dass phpmyadmin nicht nötig ist ist schon mal eine wertvolle info.
das mit der exT_tables.php wusste ich bereits, allerdings bin ich nicht so ganz schlau aus dieser datei geworden, weil irgedwie die anderen felder auch nicht so recht auftauchen. also die felder die es schon gibt.

ich würde gerne unter das feld question_subtext ein feld explain mit genau den gleichen feld eigentschaften setzen und bekomme es nicht im backend angezeigt...
vielleicht kannst du ja nochmal schauen. ich poste mal den code...

<?php
if (!defined ('TYPO3_MODE')) 	die ('Access denied.');

	// get extension confArr
$arrConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['pbsurvey']);
	// disable/enable adding of text (copy[*]) to text of copied records
$blnPrependAtCopy = $arrConfiguration['prependAtCopy']?'LLL:EXT:lang/locallang_general.php:LGL.prependAtCopy':' ';

$TCA['tx_pbsurvey_item'] = array (
	'ctrl' => array (
		'title' => 'LLL:EXT:pbsurvey/lang/locallang_db.xml:tx_pbsurvey_item',		
		'label' => 'question',
		'label_alt' => 'question_type',	
		'tstamp' => 'tstamp',
		'crdate' => 'crdate',
		'cruser_id' => 'cruser_id',
		'prependAtCopy' => $blnPrependAtCopy,
		'useColumnsForDefaultValues' => 'type',
		'transOrigPointerField' => 'l18n_parent',
		'transOrigDiffSourceField' => 'l18n_diffsource',
		'languageField' => 'sys_language_uid',
		'type' => 'question_type',
		'typeicon_column' => 'question_type',	
		'typeicons' => array (
			'0' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_tx_pbsurvey_item.gif',
			'1' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_pbsurvey_item_1.gif',
			'2' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_pbsurvey_item_2.gif',
			'3' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_pbsurvey_item_3.gif',
			'4' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_pbsurvey_item_4.gif',
			'5' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_pbsurvey_item_5.gif',
			'6' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_pbsurvey_item_6.gif',
			'7' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_pbsurvey_item_7.gif',
			'8' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_pbsurvey_item_8.gif',
			'9' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_pbsurvey_item_9.gif',
			'10' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_pbsurvey_item_10.gif',
			'11' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_pbsurvey_item_11.gif',
			'12' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_pbsurvey_item_12.gif',
			'13' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_pbsurvey_item_13.gif',
			'14' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_pbsurvey_item_14.gif',
			'15' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_pbsurvey_item_15.gif',
			'16' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_pbsurvey_item_16.gif',
			'17' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_pbsurvey_item_17.gif',
			'18' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_pbsurvey_item_18.gif',
			'19' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_pbsurvey_item_19.gif',
			'20' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_pbsurvey_item_20.gif',
			'21' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_pbsurvey_item_21.gif',
			'22' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_pbsurvey_item_22.gif',
			'23' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_pbsurvey_item_23.gif',
		),
		'sortby' => 'sorting',	
		'delete' => 'deleted',	
		'enablecolumns' => array (		
			'disabled' => 'hidden',
		),
		'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php',
		'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_tx_pbsurvey_item.gif',
	),
//	'feInterface' => array (
//		'fe_admin_fieldList' => 'hidden,question_type,question,question_alias,question_subtext,page_title,page_introduction,options_required,options_random,options_alignment,options_minimum_responses,options_maximum_responses,answers,answers_allow_additionional,answers_type_additional',
//	)
);

$TCA['tx_pbsurvey_results'] = array (
	'ctrl' => array (
		'title' => 'LLL:EXT:pbsurvey/lang/locallang_db.xml:tx_pbsurvey_results',		
		'label' => 'uid',	
		'tstamp' => 'tstamp',
		'crdate' => 'crdate',	
		'delete' => 'deleted',	
		'enablecolumns' => array (		
			'disabled' => 'hidden',
		),
		'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php',
		'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_tx_pbsurvey_results.gif',
	),
);

$TCA['tx_pbsurvey_answers'] = array (
	'ctrl' => array (
		'title' => 'LLL:EXT:pbsurvey/lang/locallang_db.xml:tx_pbsurvey_answers',		
		'label' => 'question',	
		'tstamp' => 'tstamp',
		'crdate' => 'crdate',
		'delete' => 'deleted',	
		'enablecolumns' => array (		
			'disabled' => 'hidden',
		),
		'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php',
		'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY).'icons/icon_tx_pbsurvey_results.gif',
	),
);

t3lib_div::loadTCA('tt_content');
	// Exclude fields from displaying and add FlexForm content
$TCA['tt_content']['types']['list']['subtypes_excludelist'][$_EXTKEY.'_pi1']='layout,select_key,pages,recursive';
$TCA['tt_content']['types']['list']['subtypes_addlist'][$_EXTKEY.'_pi1']='pi_flexform';
	// Add tablename to default list of allowed tables on pages. Otherwise only in SysFolders
t3lib_extMgm::allowTableOnStandardPages('tx_pbsurvey_item');
t3lib_extMgm::allowTableOnStandardPages('tx_pbsurvey_results');
t3lib_extMgm::allowTableOnStandardPages('tx_pbsurvey_answers');
	// Adds Questionaire to the list of plugins in content elements of type 'Insert plugin'
t3lib_extMgm::addPlugin(array('LLL:EXT:pbsurvey/lang/locallang_db.xml:tt_content.list_type_pi1', $_EXTKEY.'_pi1'),'list_type');
	// Adds an entry to the 'ds' array of the tt_content field 'pi_flexform'.
t3lib_extMgm::addPiFlexFormValue('pbsurvey_pi1', 'FILE:EXT:pbsurvey/flexform_ds.xml');
	// initialize static extension templates
t3lib_extMgm::addStaticFile($_EXTKEY,'static/css/','default CSS-styles');
	// initialize 'context sensitive help' (csh)
t3lib_extMgm::addLLrefForTCAdescr('tx_pbsurvey_item','EXT:pbsurvey/csh/locallang_pbsurvey_item.xml');
t3lib_extMgm::addLLrefForTCAdescr('tx_pbsurvey_results','EXT:pbsurvey/csh/locallang_pbsurvey_results.xml');
t3lib_extMgm::addLLrefForTCAdescr('tx_pbsurvey_answers','EXT:pbsurvey/csh/locallang_pbsurvey_answers.xml');
t3lib_extMgm::addLLrefForTCAdescr('xEXT_pbsurvey','EXT:pbsurvey/csh/locallang_manual.xml');
t3lib_extMgm::addLLrefForTCAdescr('_MOD_web_txpbsurveyM1','EXT:pbsurvey/csh/locallang_mod1.xml');
t3lib_extMgm::addLLrefForTCAdescr('_MOD_web_txpbsurveyM1','EXT:pbsurvey/csh/locallang_modfunc1.xml');
	// sets the transformation mode for the RTE to "ts_css" if the extension css_styled_content is installed (default is: "ts")
if (t3lib_extMgm::isLoaded('css_styled_content')) {
	t3lib_extMgm::addPageTSConfig('RTE.config.tx_pbsurvey_item.page_introduction.proc.overruleMode=ts_css');
	t3lib_extMgm::addPageTSConfig('RTE.config.tx_pbsurvey_item.question_subtext.proc.overruleMode=ts_css');
}
if (TYPO3_MODE=='BE') {
	$TBE_MODULES_EXT['xMOD_db_new_content_el']['addElClasses']['tx_pbsurvey_pi1_wizicon'] = t3lib_extMgm::extPath($_EXTKEY).'pi1/class.tx_pbsurvey_pi1_wizicon.php';
	t3lib_extMgm::addModule('web','txpbsurveyM1','',t3lib_extMgm::extPath($_EXTKEY).'mod1/');
	t3lib_extMgm::insertModuleFunction('web_txpbsurveyM1','tx_pbsurvey_modfunc1',t3lib_extMgm::extPath($_EXTKEY).'modfunc1/class.tx_pbsurvey_modfunc1.php','LLL:EXT:pbsurvey/lang/locallang_modfunc1.xml:moduleFunction');
}
?>
Desmond ·

Habe meinen Post etwas voreilig abgeschickt und das wichtigste vergessen... in ext_tables.php musst du zwar das Feld auch eintragen (Bei 'fe_admin_fieldList').

Das feld wird aber in der Datei "tca.php" konfiguriert. Dort musst das Feld einmal in einer Liste (zuoberst im Array) eintragen, und einmal kannst du es dort wo das Feld dann hinkommt (Dort kannst du auch den Code von deiner Vorlage (question_subtext) kopieren.