Adding a status check¶
The status page lists what the module needs and what went wrong. A module adds its own entries with a status check.
A check is a service that implements Drupal\ai_disclosure\Status\StatusCheckInterface
and carries the tag ai_disclosure.status_check:
services:
my_module.status_check:
class: Drupal\my_module\Status\MyStatusCheck
tags:
- { name: ai_disclosure.status_check }
The interface has one method, items(). It returns a list of
Drupal\ai_disclosure\Status\StatusItem objects, in the order they are shown.
It may return none. The check only reads. It records nothing and starts no
long process.
public function items(): array {
return [
new StatusItem(
key: 'my_module_tool',
area: StatusArea::Video,
title: $this->t('My tool'),
value: $this->t('Not found'),
description: $this->t('The tool is not installed on the server.'),
severity: StatusSeverity::Warning,
fixRoute: 'my_module.settings',
),
];
}
The key is also the key of the entry in the status report of Drupal. Keep it
stable. The area is one of StatusArea::Images, Video, Spoken or Output.
The severity is one of StatusSeverity::Info, Ok, Warning or Error. Set
off to TRUE for a feature that is simply not enabled. It is then not
counted as a problem.
The ai_disclosure.status_registry service collects the entries of every
tagged check. A submodule that is not enabled adds nothing.