[TYPO3-english] User function in localconf
Markus Klein
markus.klein at typo3.org
Thu Jan 14 18:04:19 CET 2016
Hi!
This is mainly a question of variable scope.
If you use closure functions all the variables declared in there will have the scope limited to the function and will therefore NOT spam the global scope, which might influence other exts in the worst case.
I usually do not even declare a variable for the function itself as this one is already global as well.
<?php
defined(....;
call_user_func(function ($extKey) {
// .. do some stuff
}, $_EXTKEY);
Kind regards
Markus
------------------------------------------------------------
Markus Klein
TYPO3 CMS Core Team Member
TYPO3 .... inspiring people to share!
Get involved: typo3.org
> -----Original Message-----
> From: typo3-english-bounces at lists.typo3.org [mailto:typo3-english-
> bounces at lists.typo3.org] On Behalf Of Arno Dudek
> Sent: Thursday, January 14, 2016 4:13 PM
> To: typo3-english at lists.typo3.org
> Subject: [TYPO3-english] User function in localconf
>
> Hi!
>
> I've a questen about the new style in the localconf.php. What is the
> advantage of writing the configuration within a function?
>
> Like here in the news extension:
>
> https://git.typo3.org/TYPO3CMS/Extensions/news.git/blob/HEAD:/ext_local
> conf.php
>
> $boot = function () {
> [...]
> };
> $boot();
> unset($boot);
>
> Thanks for information :)
>
> lg arno
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
More information about the TYPO3-english
mailing list