[TYPO3-mvc] Problem with overwriting $this->settings with values from pluginConfiguration

Henjo Hoeksma me at henjohoeksma.nl
Thu Nov 3 10:25:27 CET 2011


Hi guys,

I use a service class to get this done. I found this trick somewhere but
couldn't find it anymore - so kudo's to the originator and sorry for
sharing without giving you a link!

Here's what's in the service class:
class Tx_Hhnews_Services_TsLoader {
/**
 * Gibt fuer $_EXTKEY das 'plugin.'-Array (ohne Punkte) zurueck
 *
 * @param string Extension-Key z.B.'tx_extbase'
 * @param array $typoscript
 * @return array
 */
 public static function getTsSetup($_EXTKEY, $typoscript) {
// TypoScript von $_EXTKEY lade
 return self::removeDots($typoscript['plugin.'][$_EXTKEY.'.']['settings.']);
}

/**
 * Entfernt Punkte in dem TypoScript-Array
 *
 * @return void
 */
 private static function removeDots($settings) {
$conf = array();
foreach ($settings as $key => $value)
 $conf[self::removeDotAtTheEnd($key)] = is_array($value) ?
self::removeDots($value) : $value;
return $conf;
 }

/**
 * Entfernt einen Punkt am ende von $string
 *
 * @param string $string
 * @return string $string
 */
private static function removeDotAtTheEnd($string) {
return preg_replace('/\.$/', '', $string);
 }
}

In a initialize action in my controller I use the following:

$typoscriptConfiguration =
$this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::
CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
$settings = Tx_Hhnews_Services_TsLoader::getTsSetup('tx_hhnews',
$typoscriptConfiguration);
$this->settings =
Tx_Extbase_Utility_Arrays::arrayMergeRecursiveOverrule($settings,
$this->settings, FALSE, FALSE);

As far as I have tested it works wel.
Hope this helps.

Kind regards,

Henjo

Problems are small because we learned how to deal with them.
Problems are big because we need to learn how to deal with them.


On Thu, Nov 3, 2011 at 09:39, Sebastian Schreiber
<me at schreibersebastian.de>wrote:

> Am 03.11.2011 08:44, schrieb arnaud at colleter.org:
>
>  Hi,
>>
>> I find better for me :
>> # MERGE TS settings AND Flexform settings (Flexform settings over if
>> not empty)
>> $this->settings =
>> Tx_Extbase_Utility_Arrays::**arrayMergeRecursiveOverrule(
>> $this->settings['setup'], $this->settings['flexform'], FALSE, FALSE);
>>
>> Arnaud
>>
>> On Thu, 03 Nov 2011 07:43:36 +0100, Georg Ringer<typo3 at ringerge.org>
>> wrote:
>>
>>> Hi,
>>>
>>> vielleicht hilft dir das:
>>> http://git.typo3.org/TYPO3v4/**Extensions/news.git?a=blob;f=**
>>> Classes/Controller/**NewsController.php;h=**
>>> 8353b7d37920ad4c55bd9cd32d978c**15a402740a;hb=master<http://git.typo3.org/TYPO3v4/Extensions/news.git?a=blob;f=Classes/Controller/NewsController.php;h=8353b7d37920ad4c55bd9cd32d978c15a402740a;hb=master>
>>>
>>> public function injectConfigurationManager()
>>>
>>> Georg
>>> ______________________________**_________________
>>> TYPO3-project-typo3v4mvc mailing list
>>> TYPO3-project-typo3v4mvc@**lists.typo3.org<TYPO3-project-typo3v4mvc at lists.typo3.org>
>>> http://lists.typo3.org/cgi-**bin/mailman/listinfo/typo3-**
>>> project-typo3v4mvc<http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc>
>>>
>> ______________________________**_________________
>> TYPO3-project-typo3v4mvc mailing list
>> TYPO3-project-typo3v4mvc@**lists.typo3.org<TYPO3-project-typo3v4mvc at lists.typo3.org>
>> http://lists.typo3.org/cgi-**bin/mailman/listinfo/typo3-**
>> project-typo3v4mvc<http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc>
>>
> I don´t know if the solutiion from Arnaud. If so, that sounds simple  but
> could be a little bit of an overkill.
>
> @Stefan:
> You don´t have to override the FrontendconfigurationManager but you have
> to extend the Tx_Extbase_Configuration_**ConfigurationManager and
> override the Method initializeConcreteConfiguratio**nManager.
> In my blog post, i explained that in more detail (see the last part of my
> post)
>
> You are absoultey right, that you are not able to just override the
> concrete FrontendConfigurationManager class.
>
>
>
>
> --
> Sebastian Schreiber
> (Medieninformatiker B.Sc.)
> (TYPO3 Certified Integrator)
>
> Schanzenstraße 27, Schlosserei 4
> D-51063 Köln
>
> T  0221 677 88 541
> M  0176 431 05 790
>
> Skype schreibersebastian.de
>
> me at schreibersebastian.de
> www.schreibersebastian.de
>
> Steuernummer: 217 / 5269 / 4675
>
> ______________________________**_________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc@**lists.typo3.org<TYPO3-project-typo3v4mvc at lists.typo3.org>
> http://lists.typo3.org/cgi-**bin/mailman/listinfo/typo3-**
> project-typo3v4mvc<http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc>
>


More information about the TYPO3-project-typo3v4mvc mailing list