Home » FeatureModule Explained

FeatureModule Explained

So what is a FeatureModule? A FeatureModule is a fast and simple way to extend RetsPro without hacking into core code. Again, extend RetsPro without any manual edits to make the next update work. The mbx system incorporated in RetsPro is, itself, an extension of our AppMagic for WordPress plugin. Enough with the history lesson. You came here to see how this works, so…

The method of operation is simple. Your functions throughout are going to run on a first called first fired basis. That order will generally be alpha sorted ascending based on our next concept. This entire system runs on naming conventions. From the zip name to namespaces to the API controller to a few function names your FeatureModule name is king. It is NOT recommended that you try “timing” FeatureModules through naming. That said, if you must, it works.

A FeatureModule can be a simple as a place to add_shortcode() to something more complex than the new MapSearch FeatureModule. For the dev doing custom sites all the custom work can be done in a single installable module. The functionality of a FeatureModule is implemented in 4 distinct paths

  • API
  • Hooks
  • WordPress loop
  • WPR admin pages

API

The API framework is primarily intended to be a backend for web apps. Returning JSON natively the API framework takes care of the mundane tasks of gathering user info sorting the input, handling uploads and returning consistently formatted data backed by a simple yet effective database class based on PDO and discussed below. [more]

Hooks

Hooks are simply events, primarily in core code, that may or may not be accompanied by data. Support for user submitted hooks assure the core code is updatable. Handling a hook is done by implementing a function with the same name and signature as the hook. [more]

WordPress Loop

This is simply an extension of the RetsPro WordPress plugin file and is useful to do anything you would in a WordPress plugin. Your FeatureModule’s mod_client.php file will be called after mbx services and RUNTIME_CONSTANTS are available but before RetsPro.

WPR admin pages

Support for adding admin pages with settings and menu item placement. [more]

Convenience

Common functions reference

The Mbx\DataStore\MbxPdo class is a growing library of convenience functions primarily targeting web app functionality and built on PDO.

The Mbx\Mail\MailSystem class provides simplified access to phpmailer. The function HtmlMail($to,$subj, $msg) simplifies sending HTML mails even further. Fully supports SMTP available on the CRM menu select Mail Setup.

The mbxConfig.php file contains a lot of RetsPro $config values as RUNTIME_CONSTANTS along with mbx specific values. You can avoid the global this way.

Name of author

Name: Mike Morris