Problem/Motivation
There are cases in which you may want to change the severity of a status page requirement (e.g., downgrade or upgrade) e.g. what we are doing at https://www.drupal.org/project/trusted_reverse_proxy to downgrade an error to info/checked.
Steps to reproduce
It's possible to adjust the variables for the status report page with hook_preprocess_HOOK(), e.g. hook_preprocess_status_report_page(), however this addresses the render array a little too late in the pipeline. StatusReportPage::preRenderCounters() will have already run, and so there is a certain amount of reproduction of code from this method into the preprocess function to maintain consistent presentation (e.g., when a category becomes empty and should be hidden or vice versa.)
Proposed resolution
Provide an event for modules to alter the requirements data prior to it being added to the render array.
Remaining tasks
Flesh out the approach and write code :-)
User interface changes
None
API changes
Should be backwards-compatible and existing render array-powered implementations should continue to work.
Data model changes
None
Release notes snippet
Not necessary?
Comments
Comment #2
bradjones1Comment #3
longwaveI know we are moving away from hooks to events, but it feels like adding
hook_requirements_alter()would be the simplest solution here.Comment #4
bradjones1I'm curious why hooks are perceived as simpler than events? They are not particularly difficult to set up? Appreciate your insight.
Comment #5
longwaveIn this case it's simply because
hook_requirements()already exists and so the expected Drupalism here is to havehook_requirements_alter()if you want to make changes. I agree that events are almost as simple when designed from scratch, but I think mixing both hooks and events for the same data will add confusion.Comment #6
longwaveI didn't search the issue queue until now, maybe we should revive #309040: Add hook_requirements_alter()?
Comment #7
bradjones1Marking as a duplicate of #309040: Add hook_requirements_alter()