You are here

final class ExtensionLifecycle in Drupal 10

Same name and namespace in other branches
  1. 9 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

18 files declare their use of ExtensionLifecycle
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
EntityResourceRestTestCoverageTest.php in core/modules/rest/tests/src/Kernel/EntityResource/EntityResourceRestTestCoverageTest.php
HelpController.php in core/modules/help/src/Controller/HelpController.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