Services¶
The services other code is most likely to need. Each interface is aliased to its implementation, so autowiring by interface works.
| Service | Interface | What it does |
|---|---|---|
ai_content_review.orchestrator |
ReviewOrchestrator (class) |
Runs criteria and creates records. The only creator of review_record and suggestion entities. |
ai_content_review.rule_loader |
ReviewRuleLoaderInterface |
Loads the Review Rules matching a subject or a record type. |
ai_content_review.record_loader |
ReviewRecordLoaderInterface |
Loads the latest record per criterion for one subject, or for many subjects at once. |
ai_content_review.input_hasher |
InputHasherInterface |
SHA-256 of a criterion's configuration array. |
ai_content_review.improvement_plan |
ImprovementPlanInterface |
The accepted suggestions for one subject, newest record per criterion. |
ai_content_review.summary_builder |
ReviewSummaryBuilderInterface |
Builds the ReviewSummary behind the pill and the panel. |
ai_content_review.listing_query |
ReviewListingQueryInterface |
The live query behind the Views field, sort and filters. |
ai_content_review.batch_enqueuer |
BatchEnqueuer (class) |
Fills the batch queue, one item per subject and criterion. |
ai_content_review.render_helpers |
RenderHelpersInterface |
Shared render arrays, status labels and CSRF-tokenised URLs. |
plugin.manager.review_criterion |
ReviewCriterionPluginManager |
Criterion plugins. |
plugin.manager.review_suggestion |
SuggestionPluginManager |
Suggestion plugins. |
plugin.manager.review_record_type |
ReviewRecordTypePluginManager |
Record type bundle plugins. |
Batch failures log to the logger.channel.ai_content_review channel.
ReviewOrchestrator¶
Every path into a review goes through it: the review tab, the top bar panel, the queue worker, the bulk action and cron.
| Method | Use |
|---|---|
runForSubject() |
Run every criterion a subject's rules configure. |
runCriterion() |
Run one criterion, synchronously, start to finish. |
startCriterion() / stepCriterion() |
Drive a stepped run: start it, then advance it once per poll. |
runQueuedRecord() / skipQueuedRecord() |
What the queue worker calls for an already-created record. |
findRun() |
Find an in-flight run for a subject, criterion and input hash. |
touchRun() / isRunAlive() / isStrandedRun() / releaseRun() |
Run liveness, backed by a 30 second heartbeat. |
One execution produces exactly three save() calls on a record: pending, running, then its
final status. A result that completed without a score, or whose suggestions cannot be saved, is
demoted to failed.
Run liveness deserves a note. The browser pings the heartbeat every few seconds while it drives a stepped run, so the TTL only has to outlast a few missed pings rather than a whole agent turn. A run whose browser vanished shows as paused within about 30 seconds. A clean exit sends an explicit pause and does not wait at all.
GradeEvaluator¶
A static helper, not a service:
use Drupal\ai_content_review\GradeEvaluator;
$grade = GradeEvaluator::grade($score, $passThreshold, $warnThreshold);
// GRADE_PASS, GRADE_WARN, GRADE_FAIL or GRADE_NONE
Grades are always derived at render time from the stored score and the criterion's current thresholds. They are never persisted. That is what keeps records immutable while letting a threshold change reinterpret existing results without re-running anything.
Hook classes¶
Hooks are implemented as services under src/Hook/, with thin #[LegacyHook] wrappers in
ai_content_review.module.
| Class | Implements |
|---|---|
GeneralHooks |
hook_theme(), hook_local_tasks_alter() |
EntityAccessHooks |
hook_entity_access(), denying update and delete on records and suggestions |
FormHooks |
hook_form_alter(), adding the review summary and improvement plan to entity edit forms |
ViewsHooks |
hook_views_data_alter(), defining the AI review field and filters |
ReviewRule |
The review_rule insert, update and delete hooks that flag a router rebuild |
ReviewRecordBundleClasses |
hook_entity_bundle_info_alter(), mapping bundles to their classes |
CronHooks |
hook_cron(), queueing scheduled passes |
BatchRequirements |
hook_runtime_requirements(), reporting queue depth and stalls |
Extending the review UI¶
The module ships theme templates for every rendered surface, all overridable in a theme:
ai-review-panel.html.twig, ai-review-panel-row.html.twig, ai-review-panel-headline.html.twig,
ai-review-panel-stamp.html.twig, ai-review-sidebar-row.html.twig,
ai-review-sidebar-title.html.twig, ai-review-criterion-detail.html.twig,
ai-review-suggestion-card.html.twig, ai-review-suggestion-review.html.twig,
ai-review-improvement-plan.html.twig, ai-review-listing-summary.html.twig,
ai-review-summary-toggle.html.twig.
Each file's docblock lists its variables.