Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ExtensionLifecycle.php

class 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

  • class \Drupal\Core\Extension\ExtensionLifecycle

Expanded class hierarchy of ExtensionLifecycle

7 files declare their use of ExtensionLifecycle
ComponentMetadata.php in core/lib/Drupal/Core/Theme/Component/ComponentMetadata.php
HelpController.php in core/modules/help/src/Controller/HelpController.php
ModulesListForm.php in core/modules/system/src/Form/ModulesListForm.php
ModulesListNonStableConfirmForm.php in core/modules/system/src/Form/ModulesListNonStableConfirmForm.php
ModulesUninstallForm.php in core/modules/system/src/Form/ModulesUninstallForm.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.
RSS feed
Powered by Drupal