pressbooks icon indicating copy to clipboard operation
pressbooks copied to clipboard

Some running content is stripped when importing theme option values upon theme switch

Open greatislander opened this issue 6 years ago • 1 comments

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

  1. Switch to a theme with running content as above.
  2. 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

greatislander avatar Jan 11 '19 15:01 greatislander

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.

tw77 avatar Jun 28 '22 20:06 tw77