You are here

final class ExtensionLifecycle in Drupal 9

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

13 files declare their use of ExtensionLifecycle
DefaultConfigTest.php in core/tests/Drupal/KernelTests/Config/DefaultConfigTest.php
EntityResourceRestTestCoverageTest.php in core/modules/rest/tests/src/Functional/EntityResource/EntityResourceRestTestCoverageTest.php
HelpController.php in core/modules/help/src/Controller/HelpController.php
HelpTopicsSyntaxTest.php in core/modules/help_topics/tests/src/Functional/HelpTopicsSyntaxTest.php
InfoParserUnitTest.php in core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.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

Namesort descending Modifiers Type Description Overrides
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.