Features

Read onlyYes

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 be named "enable" or have a negation, or contain 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 ... }

Attributes
#[AsAlias]
'features'
$public: true

Table of Contents

Methods

isFeatureEnabled()  : bool
Checks if a feature is active

Methods

isFeatureEnabled()

Checks if a feature is active

public isFeatureEnabled(string $featureName) : bool
Parameters
$featureName : string

the name of the feature

Return values
bool

        
On this page

Search results