class ExtensionAvailableConstraint

Check if an extension (module, theme, or profile) is available.

Attributes

#[Constraint(id: 'ExtensionAvailable', label: new TranslatableMarkup('Extension is available', [], [ 'context' => 'Validation', ]))]

Hierarchy

Expanded class hierarchy of ExtensionAvailableConstraint

1 file declares its use of ExtensionAvailableConstraint
ExtensionAvailableConstraintValidatorTest.php in core/tests/Drupal/KernelTests/Core/Extension/ExtensionAvailableConstraintValidatorTest.php

File

core/lib/Drupal/Core/Extension/Plugin/Validation/Constraint/ExtensionAvailableConstraint.php, line 14

Namespace

Drupal\Core\Extension\Plugin\Validation\Constraint
View source
class ExtensionAvailableConstraint extends SymfonyConstraint {
  
  /**
   * The error message for a module that is not available.
   *
   * @var string
   */
  public string $moduleNotExistsMessage = "Module '@name' is not available.";
  
  /**
   * The error message for a theme that is not available.
   *
   * @var string
   */
  public string $themeNotExistsMessage = "Theme '@name' is not available.";
  
  /**
   * The error message for a profile that is not available.
   *
   * @var string
   */
  public string $profileNotExistsMessage = "Profile '@name' is not available.";
  
  /**
   * The error message for a module that is not available in the profile.
   *
   * @var string
   */
  public string $couldNotLoadProfileToCheckExtension = "Profile '@profile' could not be loaded to check if the extension '@extension' is available.";
  
  /**
   * The type of extension to look for. Can be 'module', 'theme' or 'profile'.
   *
   * @var string
   */
  public string $type;
  
  /**
   * {@inheritdoc}
   */
  public function getRequiredOptions() : array {
    return [
      'type',
    ];
  }
  
  /**
   * {@inheritdoc}
   */
  public function getDefaultOption() : ?string {
    return 'type';
  }

}

Members

Title Sort descending Modifiers Object type Summary
ExtensionAvailableConstraint::$couldNotLoadProfileToCheckExtension public property The error message for a module that is not available in the profile.
ExtensionAvailableConstraint::$moduleNotExistsMessage public property The error message for a module that is not available.
ExtensionAvailableConstraint::$profileNotExistsMessage public property The error message for a profile that is not available.
ExtensionAvailableConstraint::$themeNotExistsMessage public property The error message for a theme that is not available.
ExtensionAvailableConstraint::$type public property The type of extension to look for. Can be 'module', 'theme' or 'profile'.
ExtensionAvailableConstraint::getDefaultOption public function
ExtensionAvailableConstraint::getRequiredOptions public function

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