[cvs] [Wiki] changed: TurbaCustomFields
Jan Schneider
jan at horde.org
Sat Jul 5 08:34:13 UTC 2008
jan Sat, 05 Jul 2008 04:34:13 -0400
Modified page: http://wiki.horde.org/TurbaCustomFields
New Revision: 1.1
Change log: Avoid fatal error when loading twice.
@@ -13,28 +13,30 @@
require_once 'Horde/Form.php';
require_once 'Horde/UI/VarRenderer.php';
require_once 'Horde/UI/VarRenderer/html.php';
-// In this example simply inherit from the "text" field type.
-class Horde_Form_Type_image_field extends Horde_Form_Type_text {}
+if (!class_exists('Horde_Form_Type_image_field')) {
+ // In this example simply inherit from the "text" field type.
+ class Horde_Form_Type_image_field extends Horde_Form_Type_text {}
-// The only renderer currently available (as of Horde 3.2) is the "html"
-// renderer, so we inherit from that.
-class Horde_UI_VarRenderer_turba extends Horde_UI_VarRenderer_html {
+ // The only renderer currently available (as of Horde 3.2) is the "html"
+ // renderer, so we inherit from that.
+ class Horde_UI_VarRenderer_turba extends Horde_UI_VarRenderer_html {
- // We would like to render the input field exactly like a "text"
field, so
- // simply call that render method.
- // The _renderVarInput_* methods MUST be implemented.
- function _renderVarInput_image_field($form, &$var, &$vars)
- {
- return $this->_renderVarInput_text($form, $var, $vars);
- }
+ // We would like to render the input field exactly like a "text"
+ // field, so simply call that render method.
+ // The _renderVarInput_* methods MUST be implemented.
+ function _renderVarInput_image_field($form, &$var, &$vars)
+ {
+ return $this->_renderVarInput_text($form, $var, $vars);
+ }
- // The display of the field should be rendered as an image tag.
- // The _renderVarDisplay_* methods are OPTIONAL.
- function _renderVarDisplay_image_field($form, &$var, &$vars)
- {
- return '<img src="' . htmlspecialchars($var->getValue($vars))
. '" />';
+ // The display of the field should be rendered as an image tag.
+ // The _renderVarDisplay_* methods are OPTIONAL.
+ function _renderVarDisplay_image_field($form, &$var, &$vars)
+ {
+ return '<img src="' .
htmlspecialchars($var->getValue($vars)) . '" />';
+ }
}
}
More information about the cvs
mailing list