function ComposerPatchesValidator::createErrorMessage

Appends a link to online help to an error message.

Parameters

\Drupal\Core\StringTranslation\TranslatableMarkup $message: The error message.

string $fragment: The fragment of the online help to link to.

Return value

\Drupal\Core\StringTranslation\TranslatableMarkup The final, translated error message.

1 call to ComposerPatchesValidator::createErrorMessage()
ComposerPatchesValidator::validate in core/modules/package_manager/src/Validator/ComposerPatchesValidator.php
Validates the status of the patcher plugin.

File

core/modules/package_manager/src/Validator/ComposerPatchesValidator.php, line 119

Class

ComposerPatchesValidator
Validates the configuration of the cweagans/composer-patches plugin.

Namespace

Drupal\package_manager\Validator

Code

private function createErrorMessage(TranslatableMarkup $message, string $fragment) : TranslatableMarkup {
    if ($this->moduleHandler
        ->moduleExists('help')) {
        $url = Url::fromRoute('help.page', [
            'name' => 'package_manager',
        ])->setOption('fragment', $fragment)
            ->toString();
        return $this->t('@message See <a href=":url">the help page</a> for information on how to resolve the problem.', [
            '@message' => $message,
            ':url' => $url,
        ]);
    }
    return $message;
}

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