upgrade_status.module in Upgrade Status 8.3
File
upgrade_status.module
View source
<?php
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Extension\Extension;
use Drupal\upgrade_status\ProjectCollector;
function upgrade_status_help($route_name, RouteMatchInterface $route_match) {
if ($route_name == 'upgrade_status.report') {
$help = '<p>' . t('Run the report to find out if there are detectable compatibility errors with the modules and themes installed on your site.');
if (ProjectCollector::getDrupalCoreMajorVersion() < 9) {
$help .= t('<a href=":prepare">Read more about preparing your site for Drupal 9</a>.', [
':prepare' => 'https://www.drupal.org/docs/9/how-to-prepare-your-drupal-7-or-8-site-for-drupal-9/prepare-a-drupal-8-site-for-drupal-9',
]);
}
$help .= '</p>';
return $help;
}
}
function upgrade_status_theme($existing, $type, $theme, $path) {
return [
'upgrade_status_html_export' => [
'variables' => [
'projects' => [],
],
],
'upgrade_status_ascii_export' => [
'variables' => [
'projects' => [],
],
],
'upgrade_status_summary_counter' => [
'variables' => [
'summary' => [],
],
],
];
}
function template_preprocess_upgrade_status_html_export(&$variables) {
$projects = $variables['projects'];
$types = [
'custom',
'contrib',
];
foreach ($types as $type) {
if (!empty($projects[$type])) {
foreach ($projects[$type] as $key => $project) {
$variables['projects'][$type][$key]['name'] = $projects[$type][$key]['#title'];
}
}
}
}
function template_preprocess_upgrade_status_ascii_export(&$variables) {
template_preprocess_upgrade_status_html_export($variables);
}
function upgrade_status_system_info_alter(array &$info, Extension $extension, $type) {
if ($extension
->getName() == 'upgrade_status') {
$info['project'] = $extension
->getName();
}
}