Adding extensions to SysFolder contains field

Today I tried to add yag gallery extension to the contains field of pages record in TYPO3. You surely know this feature from extensions like tt_news or fe_users. You can select what kind of extension records is hosted by a certain folder:

Besides being able to allocate a folder to extension records, you also have a nice little icon in the page tree making it more easy to identify certain folders:

So the most interesting question is how to get our value into the select field and how to add the icon.

As TCA documentation is not of much help here, it took me about one hour of googling around and of course examining tt_news configuration files.

Here comes the solution: Within your ext_tables.php add the following lines of code:

 

$TCA['pages']['columns']['module']['config']['items'][] = array('yag', 'yag', 'EXT:yag/ext_icon.gif');
t3lib_SpriteManager::addTcaTypeIcon('pages', 'contains-yag', '../typo3conf/ext/yag/ext_icon.gif');
ext_tables.php configuration for adding items to 'module' (contains) field in pages

Mind the strange syntax of the 'contains-yag' in the addTcaTypeIcon method which seems to hold on some strange convention. As we add a field value 'yag' to the values of the module field of pages table, we tell sprite manager to check whether our field 'contains yag'... somehow funny - hm?

Don't forget to clear your cache so that sprite manager adds your icon to its sprite.

Have fun!

 


 
Inhalt © Michael Knoll 2009-2012  •  Powered by TYPO3  •  TypoScript Blogging by Fabrizio Branca  •  TYPO3 Photo Gallery Management by yag  •  Impressum