[TYPO3-mvc] Naming conventions
Steffen Kamper
info at sk-typo3.de
Thu Sep 24 19:23:05 CEST 2009
Hi,
Ernesto Baschny [cron IT] schrieb:
> Bastian Waidelich schrieb:
>
>> While cleaning up the blog example I bumped upon some issues with the
>> current namings in extbase:
>>
>> Currently the plugin is registered to the global TCA at
>> tt_content.list.20.blogexample_pi1
>> That is different from the pibase extensions
>> tt_content.list.20.indexed_search, tt_content.list.20.tt_address_pi1,
>> ... (it should be "blog_example_pi1" insted of "blogexample_pi1").
>>
>> This leads to the fact, that you can't write:
>> t3lib_extMgm::addPiFlexFormValue($_EXTKEY . 'pi1', 'FILE:EXT:...');
>>
>> anymore in your ext_tables.php. Instead you'll have to do something like
>>
>> $extensionName = t3lib_div::underscoredToUpperCamelCase($_EXTKEY);
>> t3lib_extMgm::addPiFlexFormValue(strtolower($extensionName) . 'pi1',
>> 'FILE:EXT:...');
>>
>> I'd like to change this. And to avoid confusion we came up with
>> following naming conventions:
>>
>> Extension key: blog_example (= $_EXTKEY)
>> Extension name: BlogExample (used e.g. in class names)
>> Plugin name: MyPlugin
>> Plugin key: myplugin (lowercase, no underscores)
>> Plugin signature: blog_example_myplugin (used in TypoScript, TCA)
>> PluginNamespace: tx_blogexample_myplugin (used to namespace GET/POST vars)
>>
>> What do you think about this?
>
> I like it! But isn't it what we have already? Only difference is that
> instead of having lower(Extension name)+_+Plugin key we add
> EXTKEY+_+Plugin key to the static TS-setup to add it to tt_content's
> plugin list, right?
>
tt is a hirostical exception (tt_address, tt_news, tt_clap), all others
ar prefixed with tx, so naming scheme of v4 is
tx_[lowercase extkey without underscores]_[plugin name like pi1]
so it would be
tx_blogexample_pi1
>> Another issue, is the TS plugin setup..
>> Currently it is stored in plugin.tx_blogexample / module.tx_blogexample
>> But what if you have multiple plugins?
>> Shouldn't that be
>> plugin.tx_blogexample_pi1 / module.tx_blogexample_m1
>
> Yes, most extensions coming from kickstarter do it this way.
>
and correct: they are totally seperated
>> But the Configuration manager does not yet support this (it currently
>> doesn't know the plugin/module name when loading the settings)
>
should be extended that way.
> What is the "Configarion manager"?
>
It's an extbase class which reads the configuration like flexform,
typoscript and prepares the informations for the controllers.
>> And than you'd had to configure each plugin separately - is that a problem?
>
> I am not sure, but I think this has been discussed before. And I must
> confess I have no idea about extbase yet and never looked at the blog
> example in depth (shame on me!), so these opinions might not fit with
> the current status quo:
>
> There are settings that might be generic for all plugins of an
> extension, and other settings specific for a specific plugin. I think
> something like:
>
> plugin.tx_blogexample = USER
> plugin.tx_blogexample.globalSetting = 1
> ...
> plugin.tx_blogexample_pi1 =< plugin.tx_blogexample
> plugin.tx_blogexample_pi1.pluginSpecificSetting = abc
> ...
> plugin.tx_blogexample_pi2 =< plugin.tx_blogexample
> ...
>
this looks like the lib/div way :)
I do it like
plugin.tx_myext.controller1 {}
plugin.tx_myext.controller2 {}
etc. You also can use plugin.tx_myext {} for global and copy it to the
comtrollers.
vg Steffen
More information about the TYPO3-project-typo3v4mvc
mailing list