function template_preprocess_update_fetch_error_message
Same name in other branches
- 9 core/modules/update/update.report.inc \template_preprocess_update_fetch_error_message()
- 11.x core/modules/update/update.report.inc \template_preprocess_update_fetch_error_message()
Prepares variables for update fetch error message templates.
Default template: update-fetch-error-message.html.twig.
Parameters
array $variables: An associative array of template variables.
2 calls to template_preprocess_update_fetch_error_message()
- UpdateReportTest::testTemplatePreprocessUpdateFetchErrorMessageNoDblog in core/
modules/ update/ tests/ src/ Kernel/ UpdateReportTest.php - Tests the error message when failing to fetch data without dblog installed.
- UpdateReportTest::testTemplatePreprocessUpdateFetchErrorMessageWithDblog in core/
modules/ update/ tests/ src/ Kernel/ UpdateReportTest.php - Tests the error message when failing to fetch data with dblog installed.
File
-
core/
modules/ update/ update.report.inc, line 347
Code
function template_preprocess_update_fetch_error_message(&$variables) : void {
$variables['error_message'] = [
'message' => [
'#markup' => t('Failed to fetch available update data:'),
],
'items' => [
'#theme' => 'item_list',
'#items' => [
'documentation_link' => t('See <a href="@url">PHP OpenSSL requirements</a> in the Drupal.org handbook for possible reasons this could happen and what you can do to resolve them.', [
'@url' => 'https://www.drupal.org/node/3170647',
]),
],
],
];
if (\Drupal::moduleHandler()->moduleExists('dblog') && \Drupal::currentUser()->hasPermission('access site reports')) {
$options = [
'query' => [
'type' => [
'update',
],
],
];
$dblog_url = Url::fromRoute('dblog.overview', [], $options);
$variables['error_message']['items']['#items']['dblog'] = t('Check <a href="@url">your local system logs</a> for additional error messages.', [
'@url' => $dblog_url->toString(),
]);
}
else {
$variables['error_message']['items']['#items']['logs'] = t('Check your local system logs for additional error messages.');
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.