class ExtensionLifecycle

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

Extension lifecycle.

The lifecycle of an extension (module/theme etc) can go through the following progression: 1. Starts "experimental". 2. Stabilizes and goes "stable". 3. Eventually (maybe), becomes "deprecated" when being phased out. 4. Finally (maybe), becomes "obsolete" and can't be enabled anymore.

Hierarchy

Expanded class hierarchy of ExtensionLifecycle

19 files declare their use of ExtensionLifecycle
ComponentMetadata.php in core/lib/Drupal/Core/Theme/Component/ComponentMetadata.php
ComponentMetadata.php in core/modules/sdc/src/Component/ComponentMetadata.php
ConfigImportAllTest.php in core/modules/config/tests/src/Functional/ConfigImportAllTest.php
DefaultConfigTest.php in core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php
EntityFilteringThemeTest.php in core/modules/system/tests/src/Functional/Theme/EntityFilteringThemeTest.php

... See full list

File

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

Namespace

Drupal\Core\Extension
View source
final class ExtensionLifecycle {
    
    /**
     * The string used to identify the lifecycle in an .info.yml file.
     */
    const LIFECYCLE_IDENTIFIER = 'lifecycle';
    
    /**
     * The string used to identify the lifecycle link in an .info.yml file.
     */
    const LIFECYCLE_LINK_IDENTIFIER = 'lifecycle_link';
    
    /**
     * Extension is experimental. Warnings will be shown if installed.
     */
    const EXPERIMENTAL = 'experimental';
    
    /**
     * Extension is stable. This is the default value of any extension.
     */
    const STABLE = 'stable';
    
    /**
     * Extension is deprecated. Warnings will be shown if still installed.
     */
    const DEPRECATED = 'deprecated';
    
    /**
     * Extension is obsolete and installation will be prevented.
     */
    const OBSOLETE = 'obsolete';
    
    /**
     * Determines if a given extension lifecycle string is valid.
     *
     * @param string $lifecycle
     *   The lifecycle to validate.
     *
     * @return bool
     *   TRUE if the lifecycle is valid, otherwise FALSE.
     */
    public static function isValid(string $lifecycle) : bool {
        $valid_values = [
            self::EXPERIMENTAL,
            self::STABLE,
            self::DEPRECATED,
            self::OBSOLETE,
        ];
        return in_array($lifecycle, $valid_values, TRUE);
    }

}

Members

Title Sort descending Modifiers Object type Summary
ExtensionLifecycle::DEPRECATED constant Extension is deprecated. Warnings will be shown if still installed.
ExtensionLifecycle::EXPERIMENTAL constant Extension is experimental. Warnings will be shown if installed.
ExtensionLifecycle::isValid public static function Determines if a given extension lifecycle string is valid.
ExtensionLifecycle::LIFECYCLE_IDENTIFIER constant The string used to identify the lifecycle in an .info.yml file.
ExtensionLifecycle::LIFECYCLE_LINK_IDENTIFIER constant The string used to identify the lifecycle link in an .info.yml file.
ExtensionLifecycle::OBSOLETE constant Extension is obsolete and installation will be prevented.
ExtensionLifecycle::STABLE constant Extension is stable. This is the default value of any extension.

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