Problem/Motivation
BookEpubAssembler::extractImagePath() resolves the mapped cover image only when the field item directly references a File entity, i.e. a plain image field. Sites managing images through core Media — increasingly the default, and universal in distributions like LocalGov Drupal — map a media reference field and silently get no cover, because the referenced entity is a Media item, not a File.
Proposed resolution
When the referenced entity is a Media item, unwrap it via its source plugin's configured source field down to the underlying File, then resolve the real path as before. The media module remains a soft dependency: instanceof MediaInterface is safely FALSE when the class does not exist, so plain image fields and media-less sites behave exactly as today.
Remaining tasks
Review; kernel test with an image field, an image-media reference, a non-image media reference (should yield no cover), and an empty field. epub_generator_localgov_publications drops its equivalent override once this lands.
User interface changes
None; a cover image mapped through Media now simply works.
API changes
None. extractImagePath() keeps its signature; behavior widens.
Data model changes
None. The one-click field installer continues to create a plain image field as its default; sites may map an existing media field instead.
Issue fork epub_generator-3612026
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
andileco commented