[dev] Clean way to add local UI::VarRenderer::html functions

Joel Vandal jvandal at infoteck.qc.ca
Fri Aug 13 16:54:50 PDT 2004


Subject: [dev] Clean way to add local UI::VarRenderer::html functions

Hi,

It's the way I use to have custom form type:

1. Create a file in turba/lib/Form/extra.php

class Horde_Form_Type_Extra extends Horde_Form_Type {
    function init ...
    function isValid ...

2. Create a file in turba/lib/UI/VarRenderer/extra_html.php 

require_once 'Horde/UI/VarRenderer/html.php';
class Horde_UI_VarRenderer_extra_html extends Horde_UI_VarRenderer_html {
    function _renderVarInput_extension(&$form, &$var, &$vars)
    {    ...    }
    function _renderVarInput_extension2(&$form, &$var, &$vars)
    {    ...    }
}

3. Change the $renderer to include extra driver.

$params = array('varrenderer_driver' => array('turba', 'extra_html'));
$renderer = &new Horde_Form_Renderer($params);

4. Include the extra.php file.

require_once TURBA_BASE . '/lib/Form/extra.php'

--
Joel Vandal



More information about the dev mailing list