public static function get_field_instance($type, NodeElement $fieldnode, Session $session) {

        global $CFG;

        // If the field is not part of a moodleform, we should still try to find out
        // which field type are we dealing with.
        if ($type == 'field' &&
                $guessedtype = self::guess_field_type($fieldnode, $session)) {
            $type = $guessedtype;
        }

        $classname = 'behat_form_' . $type;

        // Fallsback on the type guesser if nothing specific exists.
        $classpath = $CFG->libdir . '/behat/form_field/' . $classname . '.php';
        if (!file_exists($classpath)) {
            $classname = 'behat_form_field';
            $classpath = $CFG->libdir . '/behat/form_field/' . $classname . '.php';
        }

        // Returns the instance.
        require_once($classpath);
        return new $classname($session, $fieldnode);
    }
public static function get_field_instance($type, NodeElement $fieldnode, Session $session) {

        global $CFG;

        // If the field is not part of a moodleform, we should still try to find out
        // which field type are we dealing with.
        if ($type == 'field' &&
                $guessedtype = self::guess_field_type($fieldnode, $session)) {
            $type = $guessedtype;
        }

        $classname = 'behat_form_' . $type;

        // Fallsback on the type guesser if nothing specific exists.
        $classpath = $CFG->libdir . '/behat/form_field/' . $classname . '.php';
        if (!file_exists($classpath)) {
            $classname = 'behat_form_field';
            $classpath = $CFG->libdir . '/behat/form_field/' . $classname . '.php';
        }

        // Returns the instance.
        require_once($classpath);
        return new $classname($session, $fieldnode);
    }
public static function get_field_instance ( $ type , NodeElement $ fieldnode , Session $ session ) { global $ CFG ; // If the field is not part of a moodleform, we should still try to find out // which field type are we dealing with. if ( $ type == 'field' && $ guessedtype = self :: guess_field_type ( $ fieldnode , $ session ) ) { $ type = $ guessedtype ; } $ classname = 'behat_form_' . $ type ; // Fallsback on the type guesser if nothing specific exists. $ classpath = $ CFG -> libdir . '/behat/form_field/' . $ classname . '.php' ; if ( ! file_exists ( $ classpath ) ) { $ classname = 'behat_form_field' ; $ classpath = $ CFG -> libdir . '/behat/form_field/' . $ classname . '.php' ; } // Returns the instance. require_once ( $ classpath ) ; return new $ classname ( $ session , $ fieldnode ) ; }
Returns the appropiate behat_form_field according to the provided type.

It defaults to behat_form_field.

@param string $type The field type (checkbox, date_selector, text...)
@param NodeElement $fieldnode
@param Session $session The behat session
@return behat_form_field
Returns the appropiate behat_form_field according to the provided type .