[TYPO3-dev] How to make jQuery available for tceforms?
Stig Nørgaard Færch
snf at dkm.dk
Wed Aug 22 12:50:50 CEST 2012
Den 22-08-2012 11:26, Steffen Müller skrev:
> Hi.
>
> On 22.08.2012 11:00 Stig Nørgaard Færch wrote:
>>
>> I'm trying to make jQuery available for a custom user tceform.
>> Also I need to include other jQuery plugins.
>
> You could use a hook in t3lib_pagerenderer:
> $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['re
> nder-preProcess']
>
>
Hi Steffen, I went for your suggestion:
ext_localconf.php:
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_pagerenderer.php']['render-preProcess']['jquery']
= "EXT:myext/res/class.tx_myext_hooks.php:&tx_myext_hooks->addJqByHook";
ext_tables.php:
include_once(t3lib_extMgm::extPath($_EXTKEY).'res/class.tx_myext_hooks.php');
class.tx_myext_hooks.php:
<?php
class tx_myext_hooks {
function addJqByHook($params) {
if(!is_object($GLOBALS['TSFE'])) {
$params['jsLibs']['jquery'] = array(
'file' =>
'https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js',
'section' => t3lib_PageRenderer::PART_HEADER,
'type' => 'text/javascript',
'forceOnTop' => true,
'compress' => 0,
'external' => 1,
'excludeFromConcatenation' => 1,
);
}
}
}
?>
/Stig
More information about the TYPO3-dev
mailing list