OverviewObjectiveLearn how to build a plugin-in ProdigyView.Requirements Installed version of ProdigyView with a database Understanding of the overview of plug-ins vs applications Understanding of how to install a plug-in Understanding of the DEFINESEstimated Time12 minutes www.prodigyview.com
Follow Along With Code Example1. Download a copy of the example code at www.prodigyview.com/source.2. Install the system in an environment you feel comfortable testing in.3. Proceed to plugins/HelloWorldPlugin.php www.prodigyview.com
Plugin StructureThe structure of a plug-in is very easy to build because a plug-indoes not have a structure. When building a plug-in, all youneed to do is put contents in the entry file specified in theinstallation. Plug-ins can be Procedural Code Objects/Class An add-on to an object/class HTML
HelloWorldPlugin FileLooking into the HelloWorldPlugin file, we have the following:
Procedural FunctionThe function in the file is a straight procedural function. Onceincluded, it can be called anymore in your code.
Extending ValidationThe second part of the plugin is creating an anonymousfunction and adding a custom rule to the PVValidator class. Ifyou are unsure of how this work, reference the tutorial onCustom Validation.
Switch FilesNow to see the plug-in in action, first make sure it isinstalled. Read the tutorial on installing a plug-in if you areare unsure how. Then we can head over to our examplefile.
Plugin ExampleLooking in our plug-in file, we have this.
PVBootstrap::bootSystemCalling the bootSystem method will call another method in thebootstrap called loadPlugins that will include that plug-ins thatare enabled.We also do not want to initialize the validator or it will overwriteour rule.
Calling the Procedural FunctionFirst thing we can test is called the procedural function.And to do that, all we have to do is call it.Remember that because this function is procedural, it is acallable from anymore in the code. Be careful whenmaking many procedural functions in plug-ins becausename conflicts can occur.
Validator Test Our next test is see if our rule was added in the validator. Pass some values in and see if it validates.That’s all there is to plug-ins. Very easy to install and use.
API ReferenceFor a better understanding of plug-ins, visit the api byclicking on the link below.PVPlugins More TutorialsFor more tutorials, please visit:http://www.prodigyview.com/tutorials www.prodigyview.com