[TYPO3-mvc] Accessing setup information in a hook

Thomas Skierlo pubtsk1 at pix-pro.eu
Sun Feb 17 09:18:11 CET 2013


Hi Daniel,

finally got it working - with the code from my first post. Only thing 
changed was the ext. key added, like:

                 $objectManager = t3lib_div::makeInstance('Tx_Extbase_Object_ObjectManager');

                 $configurationManager = $objectManager->get('Tx_Extbase_Configuration_ConfigurationManagerInterface');

                 $frameworkConfiguration = $configurationManager->getConfiguration(

                         Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK, 'nittygritty', 'Pi1'

                 );

                 $this->tsSettings = $frameworkConfiguration['settings'];


Still don't know why it's not possible to just inject the configuration manager here - but I don't care. At least this problem is solved. If Extbase would offer a decent kind of documentation, like Zend Framework, it even might be fun developing with.

Thanks for your help,

Regards,

Thomas

Am 16.02.2013 22:35, schrieb Daniel Siepmann:
> I remembered my blog post about this topic:
> http://blog.layne-obserdia.de/post/how-to-configure-commandcontrollers
> I explained how to get the configuration and how extbase works internal.
>
> I think the same should work for your hook.
>
> --
> Daniel Siepmann
> TYPO3 Editorial Team Co-Leader
>
> TYPO3 .... inspiring people to share!
> Get involved: typo3.org
>
>
> On Sat, Feb 16, 2013 at 10:00 PM, Daniel Siepmann
> <daniel.siepmann at typo3.org> wrote:
>> I tired it once inside a command controller and solved it this way:
>>             protected function initializeExportProductsCommand() {
>>              $configurationManager = $this->objectManager->get(
>> 'Tx_Extbase_Configuration_ConfigurationManager' );
>>              /* @var $configurationManager
>> Tx_Extbase_Configuration_ConfigurationManager */
>>              $this->settings = $configurationManager->getConfiguration(
>> Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK,
>> 'tx_extkey', 'pluginkey' ) );
>>
>> Of course you have to define the plugin.
>> I think there is another way but don't know.
>>
>> --
>> Daniel Siepmann
>> TYPO3 Editorial Team Co-Leader
>>
>> TYPO3 .... inspiring people to share!
>> Get involved: typo3.org
>>
>>
>> On Sat, Feb 16, 2013 at 7:27 PM, Thomas Skierlo <pubtsk1 at pix-pro.eu> wrote:
>>> Hi Daniel,
>>>
>>>
>>>> Just an idea. You are in backend mode. So you need to make your
>>>> settings available in the backend.
>>>> Do so by adding
>>>>
>>>> module.tx_extkey < plugin.tx_extkey
>>>
>>> I already did that
>>>
>>>
>>>> Additionally I think extbase will just grab the setup from the first
>>>> root page. So you have to add this config to the rootpage.
>>>> Don't know if all these information are right. Just test and give
>>>> feedback.
>>>
>>> Yes, it's added, but debugging the result always shows "empty". Tried it for
>>> 16 hours now. Can access settings from my controller, from my dedicated
>>> settingsService, from my ViewHelpers, but no way to access settings in BE.
>>> Tried it via injection of the configurationManager (accessing a non object
>>> error) as well as this monster I've found in the mailing lists (array_push
>>> error)
>>>
>>> $this->initTSFE();
>>>
>>> as well
>>>
>>> /**
>>>    * Initializes TSFE and sets $GLOBALS['TSFE'].
>>>    *
>>>    * @return void
>>>    */
>>> protected function initTSFE() {
>>>          $GLOBALS['TSFE'] = t3lib_div::makeInstance('tslib_fe',
>>>          $GLOBALS['TYPO3_CONF_VARS'], t3lib_div::_GP('id'), '');
>>>          $GLOBALS['TSFE']->connectToDB();
>>>          $GLOBALS['TSFE']->initFEuser();
>>>          $GLOBALS['TSFE']->checkAlternativeIdMethods();
>>>          $GLOBALS['TSFE']->determineId();
>>>          $GLOBALS['TSFE']->getCompressedTCarray();
>>>          $GLOBALS['TSFE']->initTemplate();
>>>          $GLOBALS['TSFE']->getConfigArray();
>>>
>>>           // Get linkVars, absRefPrefix, etc
>>>          TSpagegen::pagegenInit();
>>> }
>>>
>>> Funny thing is, that I've found a lot of posts of people with the same
>>> problem. But none of the "solutions" offered seems to be one. It is good, if
>>> BE and FE are strictlyseparated, but essential things like setup fields must
>>> be available in both worlds, otherwise a hook gets useless - at least mine.
>>>
>>> Thanks anyhow for your help,
>>>
>>> Regards,
>>>
>>> Thomas
>>>
>>>
>>>> --
>>>> Daniel Siepmann
>>>> TYPO3 Editorial Team Co-Leader
>>>>
>>>> TYPO3 .... inspiring people to share!
>>>> Get involved: typo3.org
>>>>
>>>>
>>>> On Sat, Feb 16, 2013 at 4:57 PM, Thomas Skierlo <pubtsk1 at pix-pro.eu>
>>>> wrote:
>>>>> Hallo again,
>>>>>
>>>>> I'm currently trying to manipulate a Flexform using
>>>>> "getFlexFormDS_postProcessDS" hook from "t3lib_BEfunc". The hook works
>>>>> perfectly with test data, but I need it to work with settings from my
>>>>> Setup.
>>>>> Tried to access them like this...
>>>>>
>>>>> $objectManager =
>>>>> t3lib_div::makeInstance('Tx_Extbase_Object_ObjectManager');
>>>>>
>>>>> $configurationManager =
>>>>>
>>>>> $objectManager->get('Tx_Extbase_Configuration_ConfigurationManagerInterface');
>>>>>
>>>>> $frameworkConfiguration = $configurationManager->getConfiguration(
>>>>>
>>>>>
>>>>> Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
>>>>>
>>>>> $this->settings = $frameworkConfiguration['settings'];
>>>>>
>>>>> but a debug showed them empty.
>>>>>
>>>>> Any ideas?
>>>>>
>>>>> Regards,
>>>>>
>>>>> Thomas
>>>>>
>>>>> _______________________________________________
>>>>> TYPO3-project-typo3v4mvc mailing list
>>>>> TYPO3-project-typo3v4mvc at lists.typo3.org
>>>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>>>> _______________________________________________
>>>> TYPO3-project-typo3v4mvc mailing list
>>>> TYPO3-project-typo3v4mvc at lists.typo3.org
>>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>>>
>>> _______________________________________________
>>> TYPO3-project-typo3v4mvc mailing list
>>> TYPO3-project-typo3v4mvc at lists.typo3.org
>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>> _______________________________________________
>> TYPO3-project-typo3v4mvc mailing list
>> TYPO3-project-typo3v4mvc at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
> _______________________________________________
> TYPO3-project-typo3v4mvc mailing list
> TYPO3-project-typo3v4mvc at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc



More information about the TYPO3-project-typo3v4mvc mailing list