[TYPO3-dev] TS config in BE ?
Jerome Schneider
typo3dev at ameos.com
Tue Jul 4 14:16:28 CEST 2006
Hello,
Here is an example :
my FE plugin uses TS config to populate the content of some listboxes used
when creating records.
I want this data to be available as well in the TCEforms for editing records
in the BE ( by the so-called 'ADMIN' BE user )
For the moment, I do this :
in the TCA :
/************************************/
"myfield" => Array (
"exclude" => 0,
"label" => "mylabel",
"config" => Array (
"type" => "select",
'items' => Array(),
"size" => "1",
"minitems" => 0,
"maxitems" => 1,
"itemsProcFunc" => "tx_myplugin->_getListForTCA",
)
)
/************************************/
And the corresponding "itemsProcFunc" PHP :
/************************************/
<?php
require_once (PATH_t3lib."class.t3lib_page.php");
require_once (PATH_t3lib."class.t3lib_tstemplate.php");
require_once (PATH_t3lib."class.t3lib_tsparser_ext.php");
require_once (PATH_t3lib."class.t3lib_scbase.php");
class tx_myplugin {
function _getListForTCA(&$aParams, &$oObj) {
$aConf = $this->_getTSConf();
reset($aConf);
while(list($iKey, $sVal) = each($aConf)) {
$aParams["items"][] = array(
$sVal,
$iKey
);
} // end function
function _getTSConf($sKey) {
global $tmpl;
$tmpl = t3lib_div::makeInstance("t3lib_tsparser_ext"); // Defined global
here!
$tmpl->tt_track = 0; // Do not log time-performance information
$tmpl->init();
$pageId = $GLOBALS["SOBE"]->viewId;
$template_uid = 0;
// Gets the rootLine
$sys_page = t3lib_div::makeInstance("t3lib_pageSelect");
$rootLine = $sys_page->getRootLine($pageId);
$tmpl->runThroughTemplates(
$rootLine,
$template_uid
);
$tmpl->generateConfig();
$aConfig = $tmpl->setup["config."]["tx_myplugin."]["mylist."];
reset($aConfig);
return $aConfig;
} // end function
} // end class
?>
/************************************/
This works very well. It gives the exact TS config passed to my FE-plugin at
runtime in the FE, depending on the current Page in the page tree.
Isn't there a better way ?
Thank you Dmitry
"Dmitry Dulepov" <typo3 at accio.lv> a écrit dans le message de news:
mailman.1.1152009847.17797.typo3-dev at lists.netfielders.de...
> Hi!
>
> Jerome Schneider wrote:
>> is there an automaticaly instanciated object that gives acces to the TS
>> template config in the BE ?
>
> What TS config do you mean exactly? TS is used to configure several parts
> of typo3.
>
> Btw, term TSConfig is reserved by USER and PAGE objects. Anything else is
> *not* TS config.
>
> Dmitry.
> --
> "It is our choices, that show what we truly are,
> far more than our abilities." (A.P.W.B.D.)
More information about the TYPO3-dev
mailing list