protected function W3CLogController::buildValidationResult in W3C Validator 8
This private method builds the validation result data.
Parameters
string $all_validated_pages: The array of all stored results for already validated pages.
string $url: The URL to build validation result for.
Return value
array The validation result.
1 call to W3CLogController::buildValidationResult()
- W3CLogController::overview in src/
Controller/ W3CLogController.php - Return the 'overview' page.
File
- src/
Controller/ W3CLogController.php, line 138
Class
- W3CLogController
- Controller routines for w3c_validator module validation log routes.
Namespace
Drupal\w3c_validator\ControllerCode
protected function buildValidationResult($all_validated_pages, $url) {
$validation = [];
// Check if the page is validated.
if (isset($all_validated_pages[$url])) {
// Retrieve the validation result.
$validation = $all_validated_pages[$url];
$validation['result'] = $this
->t('@errors errors, @warnings warnings', [
'@errors' => $validation['error_count'],
'@warnings' => $validation['warning_count'],
]);
// If page is not yet validated.
if ($validation['need_validation']) {
$validation['class'] = 'color-outdated';
$validation['status'] = $this
->t('Outdated');
}
elseif ($validation['validity']) {
$validation['class'] = $validation['warning_count'] ? 'color-warning' : 'color-status';
$validation['status'] = $this
->t('Valid');
}
else {
$validation['class'] = 'color-error';
$validation['status'] = $this
->t('Invalid');
}
}
else {
$validation['class'] = 'color-unknown';
$validation['status'] = $this
->t('Unknown');
$validation['result'] = $this
->t('Not yet validated');
}
return $validation;
}