feat: #3624729 One media reference field for the episode audio
Issue: #3624729 One media reference field for the episode audio
What this changes
The podcast episode carried two audio fields, field_audio (a local file upload) and field_audio_url (a link). An editor had to choose between them with nothing saying which one the page would render, and the two were bound to two separate components in the Canvas full template, one of which rendered empty on every episode.
This replaces both with the pattern Drupal already has for this: one media reference field, where the editor picks the bundle from the media library, the way Video and Remote video already work.
field_audiobecomes an entity reference tomedia, targeting theaudioandremote_audiobundles.field_audio_urlis removed, storage and instance.- The default form display uses the Media Library widget.
- The
fullview display renders the referenced media withentity_reference_entity_view, so each bundle renders through its own media display (a local file gives an<audio controls>player, a remote one gives the provider's embed) without the node display needing to know which bundle it got. - The Canvas
node.podcast.fullcontent template walks node → media → file for the local case, and drops the component that was bound to the removed link field. - Test content gains an audio media entity, and all twelve episodes reference it.
Blocked on varbase_media_base #3624670
The remote_audio bundle comes from varbase_media_base #3624670. field.field.node.podcast.field_audio declares a config dependency on media.type.remote_audio, so #3624670 has to land before this can apply or before the pipeline's test stage can pass. That is why this MR is a draft.
Still to do on this branch
- The BDD feature files still exercise the removed field:
tests/features/02-04-episode-with-audio-url.featurefills in "Audio URL" and asserts on#edit-field-audio-url-0-uri, andtests/features/01-01-podcast-content-type.featurenames the field too. They need rewriting against the media reference field before the🧪 Automated Functional Testingjob can pass.
Known limitation, not solved here
Canvas can only render a field through an SDC, and Vartheme BS5 ships no audio component. So inside the Canvas full template the local audio still renders through the video component (a <video> element in a 21:9 frame), and a remote-audio episode renders nothing there. A follow-up issue on Vartheme BS5 for a proper audio component is needed, alongside #3622961.
Verification
Done manually on a fresh Drupal CMS + Varbase Starter install:
- The recipe applies cleanly to a freshly installed Varbase Starter site.
field_audioisentity_referencetomediawith target bundlesaudio,remote_audio;field_audio_urlis absent.- The test-content recipe applies and all 12 episodes resolve to a real audio media entity, with no dangling references.
- The local audio media entity renders
<audio controls><source src="…varbase-example-episode.wav" type="audio/wav"></audio>through its own default display. - The Canvas template's media → file walk resolves to the right file URL.
Locally, the pipeline's validate stage (composer, yaml, recipe) passes green with gitlab-ci-local. The test stage is not runnable until #3624670 lands.
AI-Generated: Yes
Checkpoints
- Code changes
- Manual testing on a fresh install
- Automated functional test coverage updated for the new field
- Green pipeline
- Documentation
- Release notes
- Reviewed by a human
- Code review by maintainers