Skip to content

For Developers

The module's extension surface is two services and a set of replaceable parts. The dependency direction is inverted: AI tools call ai_disclosure, and ai_disclosure knows nothing about any AI tool. Nothing needs to be declared in the calling module's info.yml beyond an optional dependency on ai_disclosure.

  • Recording disclosures: ai_disclosure.recorder, the API an AI tool calls to suggest or apply a disclosure.
  • Resolving disclosures: ai_disclosure.resolver, the one place that computes an entity's effective disclosure.

ai_disclosure.api.php in the module carries the same invariants and one example per method.

The services

ai_disclosure.resolver and ai_disclosure.recorder are the two a calling module needs. The rest are the module's own parts, listed because a site can replace one through a ServiceProvider:

Service What it does
ai_disclosure.resolver resolves an entity's effective disclosure
ai_disclosure.recorder records AI involvement from code
ai_disclosure.icons the one place that knows the EU icon files: URLs, dimensions, alt text
ai_disclosure.machine_readable builds the JSON-LD and meta tag head elements from an already resolved disclosure
ai_disclosure.query_conditions the resolution precedence rewritten as SQL, for the report's views filters
ai_disclosure.field_finder finds ai_disclosure field definitions on a bundle
ai_disclosure.suggestion_storage reads and writes the suggestion table, and decides nothing
ai_disclosure.markdown converts a disclosure description from markdown to HTML

The common replacement case is ai_disclosure.machine_readable, for a site that needs another schema.org @type than the shipped mapping; see What machines see.

Stable machine names

The shipped grade and profile machine names are a stable API: code references them by ID, and they are not renamed within a major version.