Include theme print stylesheets in Book printer friendly export

Created on 11 November 2011, over 12 years ago
Updated 1 May 2024, about 2 months ago

Problem/Motivation

Book module renders export pages with custom page template that should contain "print.css" but this broken because asset hardcoded relatively to current page.
Also there's no way to alter assets attached to the page because response is returned from controller without processing assets (to prevent unneeded styling)

Steps to reproduce:
1) enable book module and create new book node
2) visit "Printer-friendly version" like /book/export/html/1
3) make sure print.css loaded

currently it's broken because path should be core/misc/print.css

Proposed resolution

Make new library core/drupal.print with print.css
Allow theme libraries to override/extend drupal.print library
Add tests and commit

Remaining tasks

find a way to render attached libraries in custom responses that should skip page template from active theme

User interface changes

libraries attached in book export pages should be rendered

API changes

no

Original report by [@pianomansam]

The book module should really have the capability to pull in the print stylesheets from the active theme. Right now it is hardcoded in book-export-html.tpl.php to only pull in misc/print.css and getting it to do more requires copying the template file into the theme directory and manually pulling in a print stylesheet. This is very hackish and uncharacteristic of the Drupal Way.

πŸ› Bug report
Status

Needs work

Version

1.0

Component
BookΒ  β†’

Last updated 10 days ago

  • Maintained by
  • πŸ‡ΊπŸ‡ΈUnited States @pwolanin
Created by

πŸ‡ΊπŸ‡ΈUnited States pianomansam

Live updates comments and jobs are added and updated live.
  • Needs backport to D7

    After being applied to the 8.x branch, it should be considered for backport to the 7.x branch. Note: This tag should generally remain even after the backport has been written, approved, and committed.

  • CSS

    It involves the content or handling of Cascading Style Sheets.

  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024