WP Pro Quiz Plugin Structure

Home Forums WP Pro Quiz WP Pro Quiz Plugin Structure

This topic contains 0 replies, has 1 voice, and was last updated by  Joel Milne 12 months ago.

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #3971

    Joel Milne
    Keymaster

    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();
    $view->doStuff()
    $view->show();

    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.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.