function ExtensionLifecycle::isValid

Same name in other branches
  1. 9 core/lib/Drupal/Core/Extension/ExtensionLifecycle.php \Drupal\Core\Extension\ExtensionLifecycle::isValid()
  2. 11.x core/lib/Drupal/Core/Extension/ExtensionLifecycle.php \Drupal\Core\Extension\ExtensionLifecycle::isValid()

Determines if a given extension lifecycle string is valid.

Parameters

string $lifecycle: The lifecycle to validate.

Return value

bool TRUE if the lifecycle is valid, otherwise FALSE.

3 calls to ExtensionLifecycle::isValid()
ComponentMetadata::__construct in core/modules/sdc/src/Component/ComponentMetadata.php
ComponentMetadata constructor.
ComponentMetadata::__construct in core/lib/Drupal/Core/Theme/Component/ComponentMetadata.php
ComponentMetadata constructor.
InfoParserDynamic::parse in core/lib/Drupal/Core/Extension/InfoParserDynamic.php

File

core/lib/Drupal/Core/Extension/ExtensionLifecycle.php, line 56

Class

ExtensionLifecycle
Extension lifecycle.

Namespace

Drupal\Core\Extension

Code

public static function isValid(string $lifecycle) : bool {
    $valid_values = [
        self::EXPERIMENTAL,
        self::STABLE,
        self::DEPRECATED,
        self::OBSOLETE,
    ];
    return in_array($lifecycle, $valid_values, TRUE);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.