Our plugin that we use at Lumen added a few additional “Theme Option” tabs under “Appearance” in the admin area. I just noticed in the change log for 3.7.0 that it looks like the Global, mPDF, eBook, and Web Options have been given their own classes that extend “\Pressbooks\Options”? Would this have effected the way the “Theme Options” area works? Is there a way 3rd party plugins can hook into something to add more Theme options, and if not, is this something that you’d be open to having?
Also, I’m getting an error on the Theme Option page under the mPDF Options Tab that reads:
Notice: Undefined index: mpdf_fontsize in /sites/wordpress/wp-content/plugins/pressbooks/includes/modules/themeoptions/class-pb-mpdfoptions.php on line 318
In short: yes, there is a way third-party plugins can hook in to add theme options. Still needs a bit more work. I will be in touch this coming week to get you some more info.
Happy New Year!
P.S. Re: the undefined index error, that’s probably a situation where we should be calling isset before trying to access an option array key. As per this thread, the mPDF exporter hasn’t been updated much of late.
I am regrouping post-vacation but would like to return to work on this, @Bryan, and I would love to collaborate with you on it as it seems to be of mutual interest. Let’s be in touch tomorrow? Also related: https://github.com/pressbooks/pressbooks/issues/456
@ned, just got our plugin working with the changes that were made to theme options. But yeah, probably some things could be made better. Let me know how I might be able to help with this.
Thanks for this, Bryan—super helpful! I am working in an open PR (https://github.com/pressbooks/pressbooks/pull/618) and will probably ask for some help & testing from you as I wrap it up. Will keep you posted.
Preliminary testing seems to be going nicely. I’m having to rebuild some of our old theme options. So far, so good though. I’ll let you know if I run into any issues.
Will you be creating any documentation for others to reference on how to add/edit theme options beyond the examples you linked to above? They are clear to me, but I can imagine it being difficult to follow for others down the road.