‪TYPO3CMS  10.4
TYPO3\CMS\Core\Configuration\Features Class Reference

Public Member Functions

bool isFeatureEnabled (string $featureName)
 

Protected Attributes

array $alwaysActiveFeatures
 

Detailed Description

A lightweight API class to check if a feature is enabled.

Features are simple options (true/false), and are stored in the global configuration array $TYPO3_CONF_VARS[SYS][features].

For disabling or enabling a feature the "ConfigurationManager" should be used.

– Naming –

Feature names should NEVER named "enable" or having a negation, or containing versions or years "enableFeatureXyz" "disableOverlays" "schedulerRevamped" "useDoctrineQueries" "disablePreparedStatements" "disableHooksInFE"

Proper namings for features "ExtendedRichtextFormat" "NativeYamlParser" "InlinePageTranslations" "TypoScriptParserIncludesAsXml" "NativeDoctrineQueries"

Ideally, these feature switches are added via the Install Tool or via FactoryConfiguration and can be used for Extensions as well.

— Usage —

if (GeneralUtility::makeInstance(Features::class)->isFeatureEnabled('InlineSvg')) { ... do stuff here ... }

Definition at line 55 of file Features.php.

Member Function Documentation

◆ isFeatureEnabled()

bool TYPO3\CMS\Core\Configuration\Features::isFeatureEnabled ( string  $featureName)

Checks if a feature is active

Parameters
string$featureName‪the name of the feature
Returns
‪bool

Definition at line 77 of file Features.php.

References $GLOBALS.

Member Data Documentation

◆ $alwaysActiveFeatures

array TYPO3\CMS\Core\Configuration\Features::$alwaysActiveFeatures
protected
Initial value:
= array(
'simplifiedControllerActionDispatching',
'unifiedPageTranslationHandling'
)

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.

Usually, this list is kept for 1-2 major versions.

Definition at line 65 of file Features.php.