Problem/Motivation
On the "Status report", the five boxes in the "General System Information" are hard-coded in status-report-general-info.html.twig. This means that if a developer wants to add a box, they need to override this template. There should be an easier way.
Example use case: We are making a custom web app for a client. We want the version and other information about the app prominently displayed on the status page. We currently use hook_requirements() to add this to the "Checked" section of "Status Details". We would like something more prominent.
Proposed resolution
Refactor status-report-general-info.html.twig so that it is looping through an array of items. Setup the items in a preprocess function. This allows developers to add to this section in their own preprocess function.
Remaining tasks
Agree on how it should work. Implement.
User interface changes
None.
API changes
None, except that sections can be added via preprocess.
Data model changes
None.
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | drupal-add-to-gen-info-3423531-7.patch | 4.3 KB | oo0shiny |
Issue fork drupal-3423531
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #5
kumudbWhile checkout to this current branch, getting this below error, Drupal version 11.x
Comment #6
oo0shiny commentedI've updated the code to reflect the change in D11 that was causing the error. I think this should be working now.
Comment #8
oo0shiny commentedCreated a version for 10.3 as well.
Comment #9
oo0shiny commentedHere's the 10.3.x patch for anyone who needs it.
Comment #11
jigariusI was facing a similar problem which made me realized that there are certain things in the General Info that are not dynamic. It would be good to make them dynamic so that other modules can introduce their own cards for the top of the Status Report.
1. status-report-general-info.html.twig: Instead of hard-coding elements like #drupal, #cron, #webserver, etc, consider having a "general_info" or "cards" that can contain multiple sub-elements.
2. status_report_card: Use hook_theme() to define a "system_report_card" (or "status-report-general-info-item") that will contain: title, description, icon, footer.
3. Lastly, each entry introduced by hook_requirement() could contain a flag to decide whether it's a card, e.g. card = true or highlight = true similar to what this issue attempts to do. The "weight" of the cards decide the order of appearance.
Thinking aloud, doesn't core make use of SDCs? It would be good to have a SDC for status_report_card. Those cards are cool and making them reusable will open the doors for some cool reporting features.