class StatusCheckEvent

Event fired to check the status of the system to use Package Manager.

Hierarchy

  • class \Drupal\package_manager\Event\StageEvent extends \Symfony\Contracts\EventDispatcher\Event
    • class \Drupal\package_manager\Event\PreOperationStageEvent extends \Drupal\package_manager\Event\StageEvent
      • class \Drupal\package_manager\Event\StatusCheckEvent extends \Drupal\package_manager\Event\PreOperationStageEvent

Expanded class hierarchy of StatusCheckEvent

19 files declare their use of StatusCheckEvent
AllowedScaffoldPackagesValidator.php in core/modules/package_manager/src/Validator/AllowedScaffoldPackagesValidator.php
BaseRequirementsFulfilledValidator.php in core/modules/package_manager/src/Validator/BaseRequirementsFulfilledValidator.php
BaseRequirementsFulfilledValidatorTest.php in core/modules/package_manager/tests/src/Kernel/BaseRequirementsFulfilledValidatorTest.php
BaseRequirementValidatorTrait.php in core/modules/package_manager/src/Validator/BaseRequirementValidatorTrait.php
ComposerPatchesValidator.php in core/modules/package_manager/src/Validator/ComposerPatchesValidator.php

... See full list

File

core/modules/package_manager/src/Event/StatusCheckEvent.php, line 16

Namespace

Drupal\package_manager\Event
View source
final class StatusCheckEvent extends PreOperationStageEvent {
    
    /**
     * The paths to exclude, or NULL if there was an error collecting them.
     *
     * @var \Drupal\package_manager\ImmutablePathList|null
     *
     * @see ::__construct()
     */
    public readonly ?ImmutablePathList $excludedPaths;
    
    /**
     * Constructs a StatusCheckEvent object.
     *
     * @param \Drupal\package_manager\StageBase $stage
     *   The stage which fired this event.
     * @param \PhpTuf\ComposerStager\API\Path\Value\PathListInterface|\Throwable $excluded_paths
     *   The list of paths to exclude or, if an error occurred while they were
     *   being collected, the throwable from that error. If this is a throwable,
     *   it will be converted to a validation error.
     */
    public function __construct(StageBase $stage, PathListInterface|\Throwable $excluded_paths) {
        parent::__construct($stage);
        // If there was an error collecting the excluded paths, convert it to a
        // validation error so we can still run status checks that don't need to
        // examine the list of excluded paths.
        if ($excluded_paths instanceof \Throwable) {
            $this->addErrorFromThrowable($excluded_paths);
            $excluded_paths = NULL;
        }
        else {
            $excluded_paths = new ImmutablePathList($excluded_paths);
        }
        $this->excludedPaths = $excluded_paths;
    }
    
    /**
     * Adds warning information to the event.
     *
     * @param \Drupal\Core\StringTranslation\TranslatableMarkup[] $messages
     *   One or more warning messages.
     * @param \Drupal\Core\StringTranslation\TranslatableMarkup|null $summary
     *   A summary of warning messages. Must be passed if there is more than one
     *   message.
     */
    public function addWarning(array $messages, ?TranslatableMarkup $summary = NULL) : void {
        $this->addResult(ValidationResult::createWarning($messages, $summary));
    }
    
    /**
     * {@inheritdoc}
     */
    public function addResult(ValidationResult $result) : void {
        // Override the parent to also allow warnings.
        $this->results[] = $result;
    }

}

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