From: Michael J. Rubinsky Date: Thu, 27 Jan 2011 21:49:26 +0000 (-0500) Subject: Allow specifying an application scope for custom form types. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=5a4e83c1e408192f34fe5a7a77a693143801198c;p=horde.git Allow specifying an application scope for custom form types. This allows applications to add their own Horde_Form_Type_* classes and have them be properly autoloaded. This is an interim solution only until Horde_Form is refactored after 4.0 is released.. --- diff --git a/framework/Form/Form.php b/framework/Form/Form.php index acab2917c..ab7ae6b2e 100644 --- a/framework/Form/Form.php +++ b/framework/Form/Form.php @@ -155,7 +155,12 @@ class Horde_Form { */ function getType($type, $params = array()) { - $type_class = 'Horde_Form_Type_' . $type; + if (strpos($type, ':') !== false) { + list($app, $type) = explode(':', $type); + $type_class = $app . '_Form_Type_' . $type; + } else { + $type_class = 'Horde_Form_Type_' . $type; + } if (!class_exists($type_class)) { throw new Horde_Exception(sprintf('Nonexistant class "%s" for field type "%s"', $type_class, $type)); }