function SystemAdminThemePreprocess::preprocessSystemSecurityAdvisoriesFetchErrorMessage

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/src/Theme/SystemAdminThemePreprocess.php, line 394

Class

SystemAdminThemePreprocess
Hook implementations for system.

Namespace

Drupal\system\Theme

Code

public function preprocessSystemSecurityAdvisoriesFetchErrorMessage(array &$variables) : void {
  $variables['error_message'] = [
    'message' => [
      '#markup' => $this->t('Failed to fetch security advisory data:'),
    ],
    'items' => [
      '#theme' => 'item_list',
      '#items' => [
        'documentation_link' => $this->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 ($this->moduleHandler
    ->moduleExists('dblog') && $this->currentUser
    ->hasPermission('access site reports')) {
    $options = [
      'query' => [
        'type' => [
          'system',
        ],
      ],
    ];
    $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.