-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Summary
Support an optional metadata layer for media (alt, caption, copyright, tags) in JoliMediaBundle.
Context / use-case
In real websites, media are not only file paths: editors need reusable metadata for SEO/L+JSON and editorial quality:
- alt text
- caption / legend
- copyright / credits
- tags / categorization
Typical example: gallery photos attached to pages, services, or products.
Today, JoliMedia stores media as filesystem paths and Doctrine media / media_long fields in entities. This works well for storage and transformations, but there is no native place to store reusable editorial metadata per media.
Current workaround
Projects must create a custom entity layer (e.g. MediaAsset, ServiceGalleryImage) to map media paths and metadata, then maintain custom forms, synchronization, and deletion behavior.
Proposal
Introduce an optional metadata persistence model in the bundle (or a bridge package), for example:
MediaRecord(path, library, alt, caption, copyright, tags, createdAt, updatedAt)
Potential integrations:
- Resolver API to fetch metadata from path.
- EasyAdmin media library UI to edit metadata.
- Twig helpers/components to render alt/caption fallback from metadata.
- Move/delete listeners to keep metadata rows consistent with media path changes.
Additional benefit: safer deletion when media is linked
With a metadata/entity layer, the bundle could also provide native usage checks before deletion, for example:
- prevent deleting a media if it is linked to one or more entities (RESTRICT behavior)
- show where it is used before confirming deletion
- optionally offer SET_NULL / detach strategies depending on configuration
This would make media management safer for editors and avoid broken content after accidental deletes.
Why this matters
- Better accessibility and SEO at scale.
- Reusable metadata across pages/components.
- Less custom boilerplate in each project.