For Developers¶
The module's extension surface is three services and a few extension points. 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. - Resolving disclosures for files:
ai_disclosure.file_resolver, for a caller that starts from a file or a URI instead of an entity. - Looking up grades by IPTC URI:
ai_disclosure.grade_lookup, for a caller that starts from a C2PA manifest's IPTC URI instead of an entity. - The icon position of a file:
ai_disclosure.icon_positionand the event it dispatches, for a caller that moves the icon on one image. - The derivative saved event: an event after an
image style wrote a derivative, from the
ai_disclosure_imagesubmodule, for a caller that marks finished image files. - Labelled copies of audio and video:
the
ai_disclosure_av.renderertag and theRenditionRendererInterface, from theai_disclosure_avsubmodule, for a module that makes a labelled copy of a video or audio file. - Adding a status check: the
ai_disclosure.status_checktag andStatusCheckInterface, for a module that adds entries to the status page. - The AI disclosure panel of a media form:
hook_ai_disclosure_media_preview_alter()andMediaPanel::attach(), for a module that adds a preview or a section to the panel. - The Tool plugin:
ai_disclosure_tool, the same recorder wrapped as a plugin for the contributed Tool API module, for a caller that is an AI agent rather than a module.
ai_disclosure.api.php in the module carries the same invariants and one
example per method.
The services¶
ai_disclosure.resolver, ai_disclosure.recorder and
ai_disclosure.grade_lookup are the three a calling module needs. The services
below are public: each is backed by an interface or documented in this
section. A site can replace one through a ServiceProvider:
| Service | What it does |
|---|---|
ai_disclosure.resolver |
resolves an entity's effective disclosure |
ai_disclosure.file_resolver |
resolves the effective disclosure of a file or URI, through the entities that use it |
ai_disclosure.recorder |
records AI involvement from code |
ai_disclosure.grade_lookup |
finds the grades that carry a given IPTC digital source type URI |
ai_disclosure.icon_position |
stores the icon position chosen for a file, and tells the effective one |
ai_disclosure.machine_readable |
builds the JSON-LD and meta tag head elements from an already resolved disclosure, including the buildMediaJsonLd() node for a media asset |
ai_disclosure.media_panel |
puts sections into the panel of a media form, see the panel |
ai_disclosure.media_preview_builder |
builds the preview render arrays for that panel |
All other services of the module are internal. They are final classes, and their methods may change in any release.
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.