[TYPO3-dev] new EXT:categorize to categorize everything

Ernesto Baschny [cron IT] ernst at cron-it.de
Mon Oct 20 20:02:06 CEST 2008


Georg Ringer wrote: on 20.10.2008 18:19:

> Ernesto Baschny [cron IT] schrieb:
>> I was wondering how this is related to the "categories" extensions that
>> was being developed by Mads Brunn under the "ECT" unbrella
>> (http://forge.typo3.org/projects/show/extension-categories).
> 
> not related but I will look at it.
> 
>> Another thing: have you thought about having a single global
>> "tx_categorize_mm" table which all other tables could use (with
>> tablenames + ident fields)? I was thinking something like DAM project
>> has done for other extensions to be able to use DAM media without having
>> to create aditional "MM-tables" (tx_dam_mm_ref).
> 
> No I haven't but I see the advantages. What I just don't know is: How
> does the TCA needs to look like to set also the tablename in the mm-table?
> 
> Currently I do something like
> 
>         "config" => Array (
>             'type' => 'select',
>             'form_type' => 'user',
>             'userFunc' => 'tx_categorize_treeview->displayCategoryTree',
>             'treeView' => 1,
>             'treeName' => 'txchtreeviewexample',
>             'foreign_table' => 'tx_categorize_cat',
>             'size' => 5,
>             'autoSizeMax' => 10,
>             'minitems' => 0,
>             'maxitems' => 10,
>             "MM" => "pages_tx_categorize_cat_mm",
> 
> 
> I would change 'pages_tx_categorize_cat_mm' to 'tx_categorize_cat_mm'
> but what is the next step?
> 
> Can you help a bit?

Yes, that is the right start, but you shouldn't require extensions to
create that "config" part. Instead provide some nice method in your
extension that returns the proper PHP-array to be included in the TCA.
See DAM and the "tca_media_field.php", function txdam_getMediaTCA. The
extension that needs to add a "DAM" field (or a category selector in
your case), simply does this:

	'images' => array(
         	'exclude' => 1,
                'label' => 'Images',
		'config' => txdam_getMediaTCA('image_config', 'images'),
	),

That has the advantage that you will be able to update the "TCA" part of
all foreign extensions that are using your categorization library
without any developer having to modify their code. They should just
stick to the API, which will be enhanced as TYPO3 core also enhances
(e.g. someday core might provide nice tree-selectors as TCA fields).

Cheers,
Ernesto




More information about the TYPO3-dev mailing list