protected static function FeatureDetectionTrait::featureExists in Markdown 8.2
Determines whether a feature exists.
Parameters
string $name: The name of the feature. This name will be converted into a camel case version with "feature" as the prefix (i.e. name => featureName). This will be used to look for a static method on the object this trait is used in. If found, it will be invoked and cast to a boolean value.
Return value
bool TRUE or FALSE
5 calls to FeatureDetectionTrait::featureExists()
- SmartPunctuationExtension::buildConfigurationForm in src/
Plugin/ Markdown/ CommonMark/ Extension/ SmartPunctuationExtension.php - Form constructor.
- SmartPunctuationExtension::defaultSettings in src/
Plugin/ Markdown/ CommonMark/ Extension/ SmartPunctuationExtension.php - Provides the default settings for the plugin.
- SmartPunctuationExtension::settingsKey in src/
Plugin/ Markdown/ CommonMark/ Extension/ SmartPunctuationExtension.php - The array key name to use when the settings are nested in another array.
- TableOfContentsExtension::buildConfigurationForm in src/
Plugin/ Markdown/ CommonMark/ Extension/ TableOfContentsExtension.php - Form constructor.
- TableOfContentsExtension::defaultSettings in src/
Plugin/ Markdown/ CommonMark/ Extension/ TableOfContentsExtension.php - Provides the default settings for the plugin.
File
- src/
Traits/ FeatureDetectionTrait.php, line 34
Class
- FeatureDetectionTrait
- Trait for implementing feature detection.
Namespace
Drupal\markdown\TraitsCode
protected static function featureExists($name) {
if (!isset(static::$features[$name])) {
$class = static::class;
$method = (new CamelCaseToSnakeCaseNameConverter())
->denormalize("feature_{$name}");
static::$features[$name] = method_exists($class, $method) ? !!$class::$method() : FALSE;
}
return static::$features[$name];
}