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

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 jFormsWidgetBuilder {
   // here some common things to any controls for any builder

}

// Perhaps do an interface ?
class jFormsHtmlWidgetBuilder extends jFormsWidgetBuilder  {
   // 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 mypluginHtmlWidgetBuilder extends jFormsHtmlWidgetBuilder {
   // redefined methods and more

}

configuration

To indicate plugins we want to use.

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

;[jforms_builder_{buildername}]
[jforms_builder_html]
; controltype = pluginname
input.date = 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(
                           'ref_of_the_control'=>'plugin_name',...
             )
     )}

Last modified 8 years ago Last modified on Oct 24, 2012, 11:42:50 AM