Problem/Motivation
There are two issues here. First, more recent versions of Drupal no longer include the "Body" field by default...so we shouldn't count on it. We should also ensure that the description, which needs to be plain text per the specs, is actually plain text and not stripped HTML, which can lead to unexpected results.
Steps to reproduce
On Drupal 11.1+, create a book content type through the UI (which no longer attaches a Body field) and run the field setup action; the description mapping points at a nonexistent body field and silently produces nothing. Separately, enter HTML in the description of any book and generate: the OPF <dc:description> and the title page show literal markup instead of rendered or plain text.
Proposed resolution
Add a canonical description field (field_book_description, a text_with_summary field) to the installer so the module creates and maps it like the other metadata fields rather than assuming body exists. Render the description through the field view pipeline so its text format is applied, then flatten it with strip_tags() for the plain-text OPF <dc:description> and route it through the XHTML sanitizer for the title page.
Remaining tasks
Remaining tasks
Review; run the updated unit tests. Add kernel coverage for field creation and for the render/plain-text split, since neither is reachable from unit tests.
User interface changes
The field setup action now creates and maps a Description field on the chosen content type, independent of whether a Body field is present. Book descriptions containing HTML now render correctly on the generated title page instead of showing literal tags.
API changes
BookMetadataFieldInstaller::getFieldDefinitions() gains a thirteenth entry (description), and applyMapping() no longer hardcodes description => body. BookEpubAssembler::extractDescription() now renders via the injected renderer rather than returning the raw stored value.
Data model changes
The setup action creates one additional field storage and instance, field_book_description (text_with_summary), on the selected content type. Nothing is created on install or uninstall; the action remains opt-in and additive.
Issue fork epub_generator-3611817
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 commentedComment #5
andileco commented