function &_loadElement($event, $type, $args)
    {
        $type = strtolower($type);
        if (!self::isTypeRegistered($type)) {
            $error = self::raiseError(null, QUICKFORM_UNREGISTERED_ELEMENT, null, E_USER_WARNING, "Element '$type' does not exist in HTML_QuickForm::_loadElement()", 'HTML_QuickForm_Error', true);
            return $error;
        }
        $className = $GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'][$type][1];
        $includeFile = $GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'][$type][0];
        include_once($includeFile);
        $elementObject = new $className(); //Moodle: PHP 5.3 compatibility
        for ($i = 0; $i < 5; $i++) {
            if (!isset($args[$i])) {
                $args[$i] = null;
            }
        }
        $err = $elementObject->onQuickFormEvent($event, $args, $this);
        if ($err !== true) {
            return $err;
        }
        return $elementObject;
    }
function &_loadElement($event, $type, $args)
    {
        $type = strtolower($type);
        if (!self::isTypeRegistered($type)) {
            $error = self::raiseError(null, QUICKFORM_UNREGISTERED_ELEMENT, null, E_USER_WARNING, "Element '$type' does not exist in HTML_QuickForm::_loadElement()", 'HTML_QuickForm_Error', true);
            return $error;
        }
        $className = $GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'][$type][1];
        $includeFile = $GLOBALS['HTML_QUICKFORM_ELEMENT_TYPES'][$type][0];
        include_once($includeFile);
        $elementObject = new $className(); //Moodle: PHP 5.3 compatibility
        for ($i = 0; $i < 5; $i++) {
            if (!isset($args[$i])) {
                $args[$i] = null;
            }
        }
        $err = $elementObject->onQuickFormEvent($event, $args, $this);
        if ($err !== true) {
            return $err;
        }
        return $elementObject;
    }
function & _loadElement ( $ event , $ type , $ args ) { $ type = strtolower ( $ type ) ; if ( ! self :: isTypeRegistered ( $ type ) ) { $ error = self :: raiseError ( null , QUICKFORM_UNREGISTERED_ELEMENT , null , E_USER_WARNING , "Element '$type' does not exist in HTML_QuickForm::_loadElement()" , 'HTML_QuickForm_Error' , true ) ; return $ error ; } $ className = $ GLOBALS [ 'HTML_QUICKFORM_ELEMENT_TYPES' ] [ $ type ] [ 1 ] ; $ includeFile = $ GLOBALS [ 'HTML_QUICKFORM_ELEMENT_TYPES' ] [ $ type ] [ 0 ] ; include_once ( $ includeFile ) ; $ elementObject = new $ className ( ) ; //Moodle: PHP 5.3 compatibility for ( $ i = 0 ; $ i < 5 ; $ i ++ ) { if ( ! isset ( $ args [ $ i ] ) ) { $ args [ $ i ] = null ; } } $ err = $ elementObject -> onQuickFormEvent ( $ event , $ args , $ this ) ; if ( $ err !== true ) { return $ err ; } return $ elementObject ; }
Returns a form element of the given type

@param     string   $event   event to send to newly created element ('createElement' or 'addElement')
@param     string   $type    element type
@param     array    $args    arguments for event
@since     2.0
@access    private
@return    object    a new element
@throws    HTML_QuickForm_Error
Returns a form element of the given type