Annotations Extras — Developer Reference
Developer-focused reference for this package. For module overview and requirements see README.md. For the shared data model, permission system, AnnotationStorageService, and Target plugin API — all owned by core — see the core annotations module's own DEVELOPING.md.
Static analysis
Same tools, same commands as core — run them against this package's path instead:
ddev exec "cd /var/www/html && vendor/bin/phpcs --standard=Drupal,DrupalPractice web/modules/custom/annotations_extras --extensions=php,module,inc,install,test,profile,theme"
ddev exec "cd /var/www/html && vendor/bin/phpstan analyse web/modules/custom/annotations_extras --memory-limit=512M -c web/modules/custom/annotations_extras/phpstan.neon"
ddev exec "cd /var/www/html/web/core && node_modules/.bin/eslint --resolve-plugins-relative-to . ../modules/custom/annotations_extras"
ddev exec "cd /var/www/html/web/core && node_modules/.bin/stylelint '../modules/custom/annotations_extras/**/*.css'"
ddev exec "cd /var/www/html/web/core && node_modules/.bin/cspell -c ../modules/custom/annotations_extras/.cspell.json --no-progress ../modules/custom/annotations_extras"
Run node_modules/.bin/<tool> from web/core, not npx — see core's CLAUDE.md for why this matters for CI parity.
Drush commands
Audit scan (annotations_audit)
See modules/annotations_audit/README.md for ann:scan (--diff, --strict, --fields).
Export (annotations_export)
See modules/annotations_export/README.md for ann:ex (markdown and Obsidian vault export).
Inspection commands (ann:targets, ann:types, ann:show, ann:stats) are provided by core annotations — see its own DEVELOPING.md.
Consuming core APIs from this package
Every module here injects annotations.annotation_storage and/or plugin.manager.annotations_target from core, and annotations_extras:annotations_context's ContextAssembler/renderer services for the three modules that assemble payloads (annotations_docs, annotations_tool, annotations_export). None of these services are redeclared here — see core's DEVELOPING.md for their full API.
Adding a Target plugin in this package
Same mechanism as core — attribute discovery, no service registration:
// annotations_webform/src/Plugin/AnnotationsTarget/WebformTarget.php
#[AnnotationsTarget(
id: 'webform',
label: new TranslatableMarkup('Webforms'),
)]
class WebformTarget extends TargetBase { /* ... */ }
plugin.manager.annotations_target discovers plugins from every enabled module regardless of which package it ships in — core and extras are one plugin namespace at runtime, even though they're two Composer packages.
Documentation site
Not yet wired up — core's pages GitLab CI job (mkdocs via README.md/DEVELOPING.md mirrored into docs/) was copied into this package's .gitlab-ci.yml but still references a top-level recipes/README.md that doesn't exist here (recipes stayed in core). Strip the recipes/ lines from the pages job before relying on this package's own GitLab Pages build.
To preview locally once that's fixed:
pip install mkdocs-material
mkdir -p docs
cp README.md DEVELOPING.md docs/
for dir in modules/annotations_*/; do mkdir -p "docs/$dir"; [ -f "$dir/README.md" ] && cp "$dir/README.md" "docs/$dir/"; [ -f "$dir/DEVELOPING.md" ] && cp "$dir/DEVELOPING.md" "docs/$dir/"; done
mkdocs serve
docs/ is not committed.