Tagged: wp pro quiz structure docs
December 14, 2016 at 1:29 pm #3971
WP Pro Quiz follow an MVC (Model View Controller) structure. For those familiar with this approach, you’ll be able to find the MVC classes under wp-pro-quiz/lib/.
Under the /lib/ directory in addition to /lib/controller/, /lib/model/, /lib/view/ there are also /lib/helper/ and /lib/plugin/. The /lib/plugin/ directory has two classes, one is WpProQuiz_Plugin_BpAchievementsV2. The other is a V3 version of that. At this point we don’t know what that is or what it does. It seems the intention of this /plugins/ directory is to create a system of addons. Calling it plugins is a bit confusing though because I don’t believe these will be anything like WP plugins, but are more modular addons for the core WP Pro Quiz plugin.
Helper directory has 9 classes, which handle things like Export, Captcha, Upgrade.
There is no “template directory” in WP Pro Quiz so if you’re looking to do something at the theme layer you’ll want to focus on the “views” at /lib/view/.
The downside in this context is that using View classes and not having any regular template files makes theming more difficult. Certainly you can extend the View classes, and then make your own approach to methods such as show() which we find used for output/render. However, that’s not going to change the output that WP Pro Quiz will use in existing parts of rendering. You’ll have to hook in somehow to override the view calls. And at this point, not sure there is a way to do that.
A typical use of View for output looks something like this:
$view = new WpProQuiz_View_QuizEdit();
How do you change the object used as the view if you wish to extend with your own customized view? To enable that I believe the loading of the view object would have to be in a filter, so that it would be possible to use the filter to replace the view object.
Even if the views were more extendable, it would seem prudent that any HTML output in show() methods should be loaded from templates that follow the convention of enabling overrides at the theme layer.
You must be logged in to reply to this topic.