[Typo3-dev] Getting extension key from tablename

Kasper Skårhøj kasper2005 at typo3.com
Tue Nov 1 19:11:29 CET 2005


You can't depend on dynamicConfigFile being used in all cases theoretically.
Otherwise that might be useful.

Table names in extensions - if they follow the rules - are always on the
form "tx_[extkey-without-underscore]_something_more_maybe". So the segment
between the first and possibly second understore is - almost - the
extension key. It means you might have to traverse loaded extension keys,
remove underscores in their name, then compare with the table name segment
and if matched, you know the key. Phew.

Examples:

Extension key = "myext":
Tablenames possible: "tx_myext", "tx_myext_something", "tx_myext_foobar"

Extension key = "your_ext":
Tablenames possible: "tx_yourext", "tx_yourext_something",
"tx_yourext_foobar"


- kasper





Patrick Rodacker wrote:

> Hi List,
> 
> I've started to develop an extension (frontend plugin) using flexforms
> for the configuration which ist imho a pretty smart way for the back
> users to configure plugins.
> 
> The flexform provides an selector box with the list of TCA tables as
> entries using the special attribute for the select type.
> 
> In my extension I get the table names which is what I expected, but I
> also need the extension key of the according plugin (if available). I
> figured out that I could get the key from the dynamicConfig file using
> the TCA Array
> ($GLOBALS['TCA']['<tablename>']['ctrl']['dynamicConfigFile']), but I
> wonder if there is a smarter solution available.
> 
> Best regards
> Patrick

-- 
Kasper Skårhøj




More information about the TYPO3-dev mailing list