[TYPO3-dev] new TCA manipulation extension

Stig Nørgaard Færch snf at dkm.dk
Wed Feb 4 09:40:39 CET 2009


Steffen Kamper skrev:
> Hi,
> 
> Stig Nørgaard Færch schrieb:
>> Hi
>>
>> I've created a new extension(tcamanipulate) from which you can 
>> manipulate the TCA through the use of page TSconfig.
>>
>> It works on a hook in class.t3lib_userauth.php.
>>
>> I'm not sure if my approach is bulletproof. I guess that Manipulating 
>> the TCA in the first place isn't a very bulletproof thing to do.
>>
>> What do you think?
>> What to watch out for?
>>
>> /Stig
> 
> i do the same but not with pageTS, i do with a dynamic ext_tables.php 
> which is been written on every save action, simular to install tool 
> doing that with localconf.php.
> 
> What do you manipulate exactly?

Well this is an example where I change the tceforms of tt_news and 
tt_address in a specific folder to work as a database instead of a news 
plugin. So I reuse tt_news and tt_address instead of writing a complete 
new extension. In other folders tt_news and tt_address works like normal.

##Here I add a lib with function for label_userFunc

tx_tcamanipulate.includeLibs.test = 
fileadmin/templates/scripts/addr_title.inc

##Here I force the secondary options to be activated

TCA.tt_news.ctrl.canNotCollapse = 1
TCA.tt_address.ctrl.canNotCollapse = 1

##Here I setup the order of tt_address and change some types on some fields

TCA.tt_address {
   ctrl.label_userFunc = user_addr_title
   palettes {
     2.showitem = title, company
     4.showitem = mobile
     5.showitem = www,company
     6.showitem = zip,city
   }
   types.1.showitem = hidden;;;;1-1-1, address;;6, phone;;4, email;;5, 
first_name, description, gender;;;;3-3-3, name
   columns.gender.config {
     type = radio
     items.0.0 = Ja
     items.0.1 = 1
     items.1.0 = Nej
     items.1.1 = 0
     default = 1
   }
}

## Here I change the title of the tt_news records from News to 
Organisation and change the layout of tt_news. And I remove the wizards.

TCA.tt_news{
   ctrl {
     title = Organisation
     dividers2tabs = false
   }
   types.0.showitem = 
title;;1;;,type,editlock,datetime;;2;;1-1-1,short,bodytext;;4;richtext:rte_transform[flag=rte_enabled|mode=ts];4-4-4,no_auto_pb,--div--;Aktiviteter 
og 
Målgruppe,author;;;;,author_email;;;;,category;;;;,image;;;;1-1-1,imagecaption;;5;;,links;;;;2-2-2,related;;;;3-3-3,news_files;;;;4-4-4,--div--;Adresse 
oplysninger, tx_txsocialvejviser_adresseinformationer;;;;1-1-1
   columns.author.config.checkbox =
   columns.author_email.config.checkbox =
   columns.category.config.size = 20
   columns.category.config.autoSizeMax = 20
   columns.category.config.wizards.add.enableByTypeConfig = 1
   columns.category.config.wizards.edit.enableByTypeConfig = 1
}


> Could you offer a pre-version?

Pre-version? What is that?


/Stig




More information about the TYPO3-dev mailing list