public function ViewsAccess::evaluate in Security Review 8
Returns the evaluation page of a result.
Usually this is a list of the findings and an explanation.
Parameters
\Drupal\security_review\CheckResult $result: The check result to evaluate.
Return value
array The render array of the evaluation page.
Overrides Check::evaluate
File
- src/
Checks/ ViewsAccess.php, line 81
Class
- ViewsAccess
- Checks for Views that do not check access.
Namespace
Drupal\security_review\ChecksCode
public function evaluate(CheckResult $result) {
$findings = $result
->findings();
if (empty($findings)) {
return [];
}
$paragraphs = [];
$paragraphs[] = $this
->t('The following View displays do not check access.');
$items = [];
foreach ($findings as $view_id => $displays) {
$view = View::load($view_id);
/** @var View $view */
foreach ($displays as $display) {
$items[] = Link::createFromRoute($view
->label() . ': ' . $display, 'entity.view.edit_display_form', [
'view' => $view_id,
'display_id' => $display,
]);
}
}
return [
'#theme' => 'check_evaluation',
'#paragraphs' => $paragraphs,
'#items' => $items,
];
}