accessibility_scanner-8.x-1.0-alpha8/accessibility_scanner.module
accessibility_scanner.module
<?php
/**
* @file
* Contains accessibility_scanner.module.
*/
use Drupal\views\ViewExecutable;
/**
* Implements hook_theme().
*/
function accessibility_scanner_theme($existing, $type, $theme, $path) {
return [
'wpa-axecore-cli-history' => [
'variables' => ['url' => NULL],
],
'wpa-axecore-cli-full-report' => [
'variables' => ['summary' => NULL, 'results' => NULL, 'url' => NULL],
],
'wpa-axecore-cli-preview' => [
'variables' => ['summary' => NULL, 'url' => NULL, 'view_button' => NULL],
],
];
}
/**
* Implements hook_views_pre_render().
*/
function accessibility_scanner_views_pre_render(ViewExecutable $view) {
// Ensure that we're looking at the correct view and that it's being used
// by the accessibility scanner.
if ($view->id() === 'web_page_archive_individual' && !empty($view->result[0]->_entity)) {
$capture_utilities = $view->result[0]->_entity->getCaptureUtilities()->getValue();
if (!empty($capture_utilities[0]['wpa_axecore_cli_capture'])) {
// Only use 2 columns instead of 4.
$view->style_plugin->options['columns'] = 2;
}
}
}
