BCcampus / pressbooks-openstax-import

[UNMAINTAINED] Pressbooks Plugin for OpenStax Textbook Import
GNU General Public License v3.0
5 stars 0 forks source link

latex plugin dependencies #17

Closed bdolor closed 7 years ago

bdolor commented 7 years ago

the mathml to LaTeX conversion requires a LaTeX plugin to be available in the PB instance. While pb-latex is part of core, quick latex has better support for multiline equations and produces svg images that do not have rendering problems upon export.

The activation of this plugin should check for the existence and activation of quick latex plugin. Should provide messaging/opportunity to download the plugin, or activate the plugin.

alex-418 commented 7 years ago

Initially considered using is_plugin_active but this method is not reliable (if a plugin filename changes it will fail). Another approach is using class_exists() and/or function_exists() to check for a known class or function in the required plugin.

An elegant solution to both check for and displaying recommended plugins to install and activate, appears to be adding the TGMPA class file to our plugins hierarchy. This requires creating a function that registers the class file, and a function with our required plugins (along with our configuration, like if it's required or recommended). I'm going to give that a try a report back.

alex-418 commented 7 years ago

TGMPA class file was a dead end, does not support wordpress multisite. Went with is_plugin_active_for_network to check for the plugin, and network_admin_notices to display the install link, and the activate plugin message if plugin is already installed but not activated.

bdolor commented 7 years ago

Left out is the use case that the plugin is installed, but not network activated. In this situation, it's left up to the user/admin at the book level to activate it.

Also, without being dismissible, the message is surely to get on someone's nerves.

alex-418 commented 7 years ago

To make admin notices dismissible (and stay dismissed on page reload) it required the use of persist-admin-notices-dismissal which was added via f5a2c28

alex-418 commented 7 years ago

Where plugin is installed, but not network activated solved via a44fbd2. Added the following message for the book admin:

book admin

alex-418 commented 7 years ago

Ready to go via #18