manuxi/sulu-abbreviations-bundle
A Sulu CMS bundle for managing abbreviations and their definitions. Maintain a central glossary in the admin, then automatically annotate terms on the frontend with accessible tooltips or expansions for consistent terminology across your site.
composer require manuxi/sulu-abbreviations-bundle and enable the bundle in config/bundles.php (Sulu bundles are usually auto-discovered, verify in the admin).docs/ first — it ships English and German docs covering publishing, translations, versions, references, teaser, http cache, smart content, selection fields, twig, settings, and the 1.x → 2.0 upgrade. If you're coming from 1.x, read UPGRADE.md before touching code.config/packages/sulu_abbreviations.yaml:
sulu_abbreviations.versioning.max_versions (default 20, 0 disables)sulu_abbreviations.twig.auto_abbr (enables the abbr Twig filter)abbr_abbreviations, abbr_abbreviation_dimension_contents, abbr_abbreviation_versions. A migration template is provided at docs/templates/doctrine-migration.php.dist.abbreviation_default (already in src/Resources/config/templates/abbreviations/) into your webspace, and add a page template that renders @SuluAbbreviations/abbreviation.html.twig.sulu_resolve_abbreviation() in your controller or the abbr filter in body copy.Admin content workflow
Every locale has independent draft/live content. Create → edit draft → publish. The controller (Controller\Admin\AbbreviationController, attribute-routed) exposes list/get/create/update/delete/publish/unpublish/remove-draft/copy-locale. Toolbar actions in the edit dropdown: “copy to locale” (only with >1 locale), “remove draft”, “unpublish”. The delete action is a dropdown: “delete” and “delete translation”.
Rendering
abbreviation_default; the Twig template receives content (replaces the old abbreviation variable).sulu_resolve_abbreviation() returns a normalized live content array, not an entity, and registers the abbreviation in the abbreviations reference store (for cache tags).sulu_get_abbreviations() also returns arrays and marks the response as a list of abbreviations.{{ text|abbr }} wraps known abbreviations in <abbr title="..."> — only registered when sulu_abbreviations.twig.auto_abbr: true.Content types and links
abbreviation_selection / single_abbreviation_selection now store UUID strings. They implement ReferenceContentTypeInterface, so pages appear in an abbreviation's references list.abbreviations: use <sulu-link provider="abbreviations" ...>. Old provider="abbreviation" links must be rewritten.Integrations
abbreviations (Teaser\AbbreviationTeaserProvider); falls back to the abbreviation image when no excerpt image is set.Content\AbbreviationsDataProvider.Resolver\AbbreviationResolver for programmatic lookups.Versioning and references
abbr_abbreviation_versions, keeping the newest max_versions per abbreviation + locale.restore_version list item action) or POST /admin/api/abbreviations/{id}/versions/{version}?action=restore&locale=xx. Restoring writes into the draft, requires EDIT, fires AbbreviationVersionRestoredEvent.Reference\AbbreviationReferenceUpdater stores draft references in the admin context, live in website. The subscriber keeps them in sync on publish/unpublish/remove-draft. Run bin/console sulu:reference:refresh abbreviations after bulk imports.HTTP caching
EventSubscriber\AbbreviationCacheInvalidationSubscriber purges pages referencing the abbreviation (alias abbreviations), plus tag and category references and abbreviation list pages. Runs after flush, on publish/unpublish/remove/restore/translation-delete. The cache manager is optional — it silently no-ops without sulu/http-cache-bundle.
Automation
Scheduled publish/unpublish requires sulu/automation-bundle (now in suggest). Install it explicitly if you want the Automation tab.
Domain events to hook
AbbreviationDraftRemovedEvent, AbbreviationTranslationRemovedEvent, AbbreviationVersionRestoredEvent, AbbreviationCopiedLanguageEvent.
sulu:abbreviations:migrate-to-content --dry-run first, then for real. It creates new UUIDs (old id kept in abbr_abbreviations.legacy_id), builds draft + live content per locale, moves routes, drops routes of unpublished translations. Idempotent, legacy tables are read-only — safe to re-run.sulu:abbreviations:migrate-page-references --dry-run. This rewrites integer ids inside abbreviation_selection / single_abbreviation_selection (including inside blocks) and <sulu-link provider="abbreviation"> links in both draft and live workspaces. Anything not covered (custom block structures, hardcoded HTML, external bookmarks) you must fix yourself.Entity\Models, Entity\Interfaces, AbbreviationTranslation, AbbreviationSeo*, AbbreviationExcerpt*, old repositories, Common\DoctrineListRepresentationFactory, Mapper\AbbreviationDataMapper, Routing\AbbreviationsRouteDefaultsProvider, Preview\AbbreviationsObjectProvider, the old task handlers. grep -r your app/ before deploying.sulu_abbreviations.objects config key is gone — remove it or the container will fail to compile.abbreviation_default structure + @SuluAbbreviations/abbreviation.html.twig page template.content, not abbreviation. Any overridden template silently renders empty.abbreviation → abbreviations; toolbar copy → copy_locale (and it now copies into another locale, not just duplicates).sulu_abbreviations.get_abbreviations_settings at /admin/api/abbreviations-settings. Anything using route() on the old name breaks.sulu_resolve_abbreviation() / sulu_get_abbreviations() return arrays now — update type hints, remove entity accessors, and use array access instead.abbr filter silently missing if twig.auto_abbr is false. Enable it before debugging a “filter not found” error.deleteLocale=true requires EDIT on that locale; you can restore from trash.Route\AbbreviationRouteRemover. Symfony 7.4 no longer registers the content bundle's Doctrine event subscriber, so this bundle-level remover is what actually cleans routes on delete.max_versions: 0 — handy on large instances to avoid table growth, but you lose the restore action entirely.sulu/http-cache-bundle nothing purges and stale pages will serve old abbreviations; verify the bundle is present if you rely on it.phpcr/phpcr-migrations-bundle and manuxi/sulu-shared-tools-bundle were removed from dependencies — if your app relied on them transitively, require them directly.admin (draft) vs website (live) contexts separately in the reference store; they diverge by design and only sync on publish/unpublish/remove-draft.tests/Functional, in-memory SQLite + PHPCR, test webspace in tests/App/config) — the fastest way to reproduce admin/API behaviour without spinning up a full instance.How can I help you explore Laravel packages today?