function template_preprocess_system_security_advisories_fetch_error_message

Same name and namespace in other branches
  1. 10 core/modules/system/system.theme.inc \template_preprocess_system_security_advisories_fetch_error_message()
  2. 11.x core/modules/system/system.theme.inc \template_preprocess_system_security_advisories_fetch_error_message()

Prepares variables for security advisories fetch error message templates.

Default template: system-security-advisories-fetch-error-message.html.twig.

Parameters

array $variables: An associative array of template variables.

File

core/modules/system/system.theme.inc, line 18

Code

function template_preprocess_system_security_advisories_fetch_error_message(array &$variables) : void {
    $variables['error_message'] = [
        'message' => [
            '#markup' => t('Failed to fetch security advisory data:'),
        ],
        'items' => [
            '#theme' => 'item_list',
            '#items' => [
                'documentation_link' => t('See <a href=":url">Troubleshooting the advisory feed</a> for possible causes and resolutions.', [
                    ':url' => 'https://www.drupal.org/docs/updating-drupal/responding-to-critical-security-update-advisories#s-troubleshooting-the-advisory-feed',
                ]),
            ],
        ],
    ];
    if (\Drupal::moduleHandler()->moduleExists('dblog') && \Drupal::currentUser()->hasPermission('access site reports')) {
        $options = [
            'query' => [
                'type' => [
                    'system',
                ],
            ],
        ];
        $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.