in2code-de / luxletter

Newsletter system for TYPO3
https://www.in2code.de/agentur/typo3-extensions/luxletter/
24 stars 25 forks source link

Plugin TS Setting are empty in Scheduler nor Console Command #92

Open pfuju opened 3 years ago

pfuju commented 3 years ago

Problem: Defining some TS Variables and add these to to plugin.settings:

plugin.tx_luxletter_fe {
    settings {
        header = Company Newsletter
        subheader = Company Slogon 
        unsubscribePid = 123
        logos {
            logoNormal = {$page.logo.file}
            logoInverted = {$page.logo.fileInverted}
        }
    }
}

In Backend Preview as well as in Frontend Preview (calling Newsletter Page with /?type= 1560777975) everything works fine. However if the Newsletter will be send via Scheduler (CLI) the debugging the variable "settings" will be empty. Checked with simple {settings}</f:debugger> in Layout Fluid Template.

Solution 1: Using Simple Viewhelper in Template Layout

Solution 2: Maybe changes in Configuration Utility can help.

/**
     * Get TypoScript settings
     *
     * @return array
     * @throws InvalidConfigurationTypeException
     * @throws Exception
     */
    public static function getExtensionSettings(): array
    {
       $ts = ObjectUtility::getConfigurationManager()->getConfiguration(
            ConfigurationManagerInterface::**CONFIGURATION_TYPE_FULL_TYPOSCRIPT**,
            'luxletter'
        return    GeneralUtility::removeDotsFromTS(
                    $ts['plugin.']['tx_luxletter_fe.']
                );
        );
    }
einpraegsam commented 3 years ago

Can you please describe the problem a bit deeper. E.g. you want to set this TypoScript and in template file Y you want to get the values, etc...

pfuju commented 3 years ago

For sure! Sorry something went wrong in my initial post. I edited it and added missing informations.

einpraegsam commented 3 years ago

Ok, I played a bit with your solution in getExtensionSettings(), but I failed some times.

Let's say we have this configuration:

plugin {
  tx_luxletter_fe {
    settings {
#     {settings.staticvalue}
       staticvalue = Static value from TypoScript
    }
    variables {
#     {dynamicvalue}
       dynamicvalue = TEXT
       dynamicvalue.value = Dynamic value from TypoScript
    }
  }
}

variables in

In this different contexts:

I'm open for every PR that fulfills this request.