function UpdateThemeHooks::preprocessUpdateFetchErrorMessage
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.
File
-
core/
modules/ update/ src/ Hook/ UpdateThemeHooks.php, line 433
Class
- UpdateThemeHooks
- Theme hooks for update module.
Namespace
Drupal\update\HookCode
public function preprocessUpdateFetchErrorMessage(array &$variables) : void {
$variables['error_message'] = [
'message' => [
'#markup' => $this->t('Failed to fetch available update data:'),
],
'items' => [
'#theme' => 'item_list',
'#items' => [
'documentation_link' => $this->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 ($this->moduleHandler
->moduleExists('dblog') && $this->currentUser
->hasPermission('access site reports')) {
$options = [
'query' => [
'type' => [
'update',
],
],
];
$dblog_url = Url::fromRoute('dblog.overview', [], $options);
$variables['error_message']['items']['#items']['dblog'] = $this->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'] = $this->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.