[TYPO3-dev] The "Object TypoScript library" in the TYPO3 core?
Ernesto Baschny [cron IT]
ernst at cron-it.de
Tue Jul 14 09:38:56 CEST 2009
Steffen Kamper schrieb:
> Hi,
>
> Martin Kutschker schrieb:
>> Xavier Perseguers schrieb:
>>> The existing hook may certainly be used instead of having something
>>> special for this very extension.
>>
>> The hook is not very useful IMHO. Either you use standard objects or you
>> use the ones the hook provides. You cannot add just a single object.
>>
>> Masi
>
> it's very easy to add an own object. I did it with the new MEDIA ce
> because i need it in 4.2 installation.
>
> This is the way to go:
> (single object MYOWNCE)
> 1)
> define tt_content.myownce like usual
>
> tt_content.myownce= COA
> tt_content.myownce {
> 10 = < lib.stdheader
>
> 20 = MYOWNCE
> 20 { ... }
> }
>
> 2) define TCA CType (ext_tables.php)
> $TCA['tt_content']['columns']['CType']['config']['myownce'] = array(
> 'label' => 'LLL:EXT:....',
> 'config' => array(...)
> );
>
> 3) use flexform?
> $TCA['tt_content']['columns']['pi_flexform']['config']['ds'][',myownce']
> = "<flexform content>";
>
> 4) define showitem
> $TCA['tt_content']['types']['myownce'] = array(
> 'showitem' => ''CType;;4;;1-1-1, hidden, header;;3;;2-2-2,
> linkToTop;;;;3-3-3,...';
> );
>
> 4) Define it for NewElementWizard (ext_localconf)
> t3lib_extMgm::addPageTSConfig('
> mod.wizards.newContentElement.wizardItems {
> myownce {
> icon = ...
> }
> special.show := addToList(myownce)
> }
>
> 5) register Hook
> $TYPO3_CONF_VARS['SC_OPTIONS']['tslib/class.tslib_content.php']['cObjTypeAndClassDefault']['media']
> = 'EXT:yourext:file.php:classname';
>
> 6) write your own class
>
> require_once(PATH_tslib .
> 'interfaces/interface.tslib_content_cobjgetsinglehook.php');
>
> class tx_cObjMyOwnCE implements tslib_content_cObjGetSingleHook {
> protected $cObj;
> public function getSingleContentObject($contentObjectName, array
> $configuration, $TypoScriptKey, tslib_cObj &$parentObject) {
> $this->cObj =& $parentObject;
> switch($contentObjectName) {
> case 'MYOWNCE':
> return $this->MYOWNCE($configuration);
> break;
> }
> }
>
> }
>
> you can write in Typoscript whatever you want, you'll find it in the
> conf array.
>
> I wrote this because i didn't found a tutorial doing this kind of stuff,
> imho it's sufficient to do your own ContentElement and use it as the
> others.
Steffen, you should "blog" this in buzz! :)
Cheers,
Ernesto
More information about the TYPO3-dev
mailing list