isFeatureEnabled('InlineSvg')) { * ... do stuff here ... * } */ #[AsAlias('features', public: true)] readonly class Features { /** * A list of features that are always activated (mainly happens if a previous feature switch is now always * "turned on" to enforce a behaviour, but still valid for extension authors to ensure the feature switch * returns "enabled" for future versions. */ private const array ALWAYS_ACTIVE_FEATURES = [ // Enabled since v15.0 at any time. 'extbase.consistentDateTimeHandling', // Enabled since v13.0 at any time. 'security.usePasswordPolicyForFrontendUsers', 'security.backend.enforceContentSecurityPolicy', // Enabled since v12.0 at any time. 'subrequestPageErrors', 'yamlImportsFollowDeclarationOrder', 'security.frontend.htmlSanitizeParseFuncDefault', 'runtimeDbQuotingOfTcaConfiguration', // Enabled since v11.0 at any time. 'fluidBasedPageModule', // Enabled since v10.0 at any time. 'simplifiedControllerActionDispatching', 'unifiedPageTranslationHandling', 'felogin.extbase', ]; /** * Checks if a feature is active * * @param string $featureName the name of the feature */ public function isFeatureEnabled(string $featureName): bool { if (in_array($featureName, self::ALWAYS_ACTIVE_FEATURES, true)) { return true; } return isset($GLOBALS['TYPO3_CONF_VARS']['SYS']['features'][$featureName]) && $GLOBALS['TYPO3_CONF_VARS']['SYS']['features'][$featureName] === true; } }