wiki:rfc/jforms-controls-plugins is not used any more and exists only for history. Post new tickets on the Github account. n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Version 2 (modified by laurentj, 10 years ago) (diff)


Plugins for jforms controls

jForms, in the builder part, should have a plugin system to provide plugin which generate the HTML for a control.

plugin implementation

A plugin could be a class inheriting from this kind of class :

class jFormsBuilderControl {
   // here some common things to any controls for any builder


class jFormsBuilderHtmlControl extends jFormsBuilderControl  {
   // here common things to any controls for the HTML builder
   protected function getClass();
   protected function getId();
   protected function getCommonJS();
   // etc..

    // here (abstract or not) methods called by the builder

   function outputLabel() { }

   function outputControl() { }

   function outputHelp() {}

   function outputJs() {}

class myplugin_BuilderHtmlControl extends jFormsBuilderHtmlControl {
   // redefined methods and more



To indicate plugins we want to use.

For any forms and specific builder, we can indicate it in defaultconfig.ini.php

; controltype = pluginname = myplugin1
htmleditor = myplugin2
textarea = myplugin3

To indicate a plugin in the template, for a specific form, we list the plugins in the array of options for the builder

{form $form,'submit_action', $actionparams, 'html',
        array('plugins'=> array(

support of this plugins in the builder

Classes for "native" controls, could be in the same file, not in plugins, to avoid to have many includes.

The builder check the configuration and then options, to retrieve the plugin name to use. If there isn't plugin name, it use the "native" class to generate the html. Else it call the plugin.