pressbooks
pressbooks copied to clipboard
Some running content is stripped when importing theme option values upon theme switch
Description
When switching themes, running content strings from the new theme are loaded into PDF theme options. However, if the string is something like:
string(book-title) ' / ' string(section-title)
Or…
string(book-title) ' / My Publishing Company'
All but the first string(book-title)
is discarded. That's because we match like this:
https://github.com/pressbooks/pressbooks/blob/dev/inc/modules/themeoptions/class-pdfoptions.php#L1488-L1496
Steps to Reproduce
- Switch to a theme with running content as above.
- Visit PDF theme options.
Expected behavior: Theme's running content has been properly imported, and displays as custom running content in PDF theme options.
Actual behavior: All but the first string()
call is discarded.
System Information
Pressbooks: 5.7.0-dev
From what I can tell, the current behaviour is that running content strings are unconditionally cleared / reset to default when switching themes. I don't see a way to preserve any modified running content strings in the PDF Theme Options when going from Malala to McLuhan, for example, or the other way around.
Even if I set every running content string to just the book title, my changes to the running content are discarded upon theme switch.