You are here

upgrade_status.module in Upgrade Status 8

File

upgrade_status.module
View source
<?php

use Drupal\Core\Routing\RouteMatchInterface;

/**
 * Implements hook_help().
 */
function upgrade_status_help($route_name, RouteMatchInterface $route_match) {
  if ($route_name == 'upgrade_status.report') {
    return '<p>' . t('Analyze your site\'s Drupal 9 readiness. Run the report to find out if there are detectable compatibility errors with the modules and themes installed on your site. <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',
    ]) . '</p>';
  }
}

/**
 * Implements hook_theme().
 */
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' => [],
      ],
    ],
  ];
}

/**
 * Preprocess project list for HTML export.
 *
 * @param array $variables
 *   Array of template variables.
 */
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'];
      }
    }
  }
}

/**
 * Preprocess project list for ASCII export.
 *
 * @param array $variables
 *   Array of template variables.
 */
function template_preprocess_upgrade_status_ascii_export(&$variables) {
  template_preprocess_upgrade_status_html_export($variables);
}

Functions

Namesort descending Description
template_preprocess_upgrade_status_ascii_export Preprocess project list for ASCII export.
template_preprocess_upgrade_status_html_export Preprocess project list for HTML export.
upgrade_status_help Implements hook_help().
upgrade_status_theme Implements hook_theme().