Access TypoScript in an extension

Note

This part is written for extension developers.

This page explains how to access TypoScript settings in an extension.

Extbase controllers

In Extbase controllers, Flexform settings and TypoScript settings will be merged together. If settings exists in both, the Flexform takes precedence and overrides the TypoScript setting. Note that both Flexform and TypoScript settings must use the convention of preceding the setting with settings. (for example, settings.threshold).

Extbase offers some advantages: Some things work automatically out-of-the-box. However, you must stick to the Extbase conventions ("conventions over configuration").

In order to access TypoScript settings from an Extbase controller.

  1. Use the convention of defining your TypoScript settings in settings

    EXT:my_extension/Configuration/TypoScript/setup.typoscript
    plugin.tx_myextension {
       view {
          # view settings
       }
    
       settings {
          key1 = value1
          key2 = value2
       }
    }
    
  2. Access them via $this->settings

    For example, in your controller:

    $myvalue1 = $this->settings['key1'] ?? 'default';
    

See also

  • Extbase TypoScript configuration

Fluid

If Extbase controllers are used, $this->settings is automatically passed to the Fluid template. Allowing you to access settings like this:

{settings.key1}