bp_xprofile_create_field_type( string $type )

Creates the specified field type object; used for validation and templating.


Parameters Parameters

$type

(string) (Required) Type of profile field to create. See bp_xprofile_get_field_types() for default core values.


Top ↑

Return Return

(object) $value If field type unknown, returns BP_XProfile_Field_Type_Textarea. Otherwise returns an instance of the relevant child class of BP_XProfile_Field_Type.


Source Source

File: bp-xprofile/bp-xprofile-functions.php

function bp_xprofile_create_field_type( $type ) {

	$field = bp_xprofile_get_field_types();
	$class = isset( $field[$type] ) ? $field[$type] : '';

	/**
	 * To handle (missing) field types, fallback to a placeholder field object if a type is unknown.
	 */
	if ( $class && class_exists( $class ) ) {
		return new $class;
	} else {
		return new BP_XProfile_Field_Type_Placeholder;
	}
}


Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.