[TYPO3-core] RFC: MM_foreign_select

René Fritz rene at typo3.org
Thu Jan 19 19:53:13 CET 2006


This is used in the current DAM which uses XCLASSes to enable it.
It is a main point to use DAM media records as references in a site.

I hope it will find it's way in the official distribution. But I don't mind if 
the solution will look like a little different if it will do the same.

There is a demo extension (bidirectional_example) that do nothing but seems to 
be a basis for discussion for the same topic. Maybe someone else implemented 
similar?



Problem:
If I want to use references with an mm table, I can do this

tt_content > tx_dam_mm_ref < tx_dam

The first thing is that I don't know to which field of tt_content this 
reference belongs to. When I have two media fields in tt_content I can't 
seperate them.
Solution: I introduced a new field in the mm table called 'ident'


The second problem is when I use another content table with references too.

tt_content > tx_dam_mm_ref < tx_dam
tx_mytable > tx_dam_mm_ref < tx_dam

The field tablenames handle this. But only if I select tt_content and 
tx_mytable from a tx_dam tceform element. But that does not make sense.

When I select a tx_dam record from tt_content, "tx_dam" will be written in 
tablenames, but that is a senseless information, I need "tt_content" in it.
Also uid_foreign and uid_local are switched.

Therefore I need a configuration that work from tt_content but LIKE from 
tx_dam.

A TCA config for my solution looks like this

'type' => 'group',
'internal_type' => 'db',
'allowed' => 'tx_dam',
'prepend_tname' => 1,
'MM' => 'tx_dam_mm_ref',
'MM_foreign_select' => 1,
'MM_ident' => 'relation_field_or_other_ident',


'MM_foreign_select'  switched uid_foreign and uid_local and set tablenames to 
the local table

'MM_ident' defines what value should be written to the "ident" field of the MM 
table. This is usually the name of the current field.

A MM table will then look like this

CREATE TABLE tx_cctestmm_local_mm (
  uid_local int(11) unsigned DEFAULT '0' NOT NULL,
  uid_foreign int(11) unsigned DEFAULT '0' NOT NULL,
  tablenames varchar(30) DEFAULT '' NOT NULL,
  ident varchar(30) DEFAULT '' NOT NULL,
  sorting int(11) unsigned DEFAULT '0' NOT NULL,
  KEY uid_local (uid_local),
  KEY uid_foreign (uid_foreign)
);



Attached is a very simple extension with 3 tables and an mm table to test 
this.

This is some month old ... hope it works

-- 
COLORCUBE
digital media lab

www.colorcube.de

-- 
René Fritz
TYPO3 Association - Active Member
http://association.typo3.org/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t3lib_tcemain.patch
Type: text/x-diff
Size: 1440 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20060119/4731f743/attachment.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t3lib_transferdata.patch
Type: text/x-diff
Size: 1856 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20060119/4731f743/attachment-0001.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t3lib_loaddbgroup.patch
Type: text/x-diff
Size: 6161 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20060119/4731f743/attachment-0002.bin 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cctestmm-20050504.zip
Type: application/x-zip
Size: 18370 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20060119/4731f743/attachment-0003.bin 


More information about the TYPO3-team-core mailing list