bp_xprofile_create_field_type( string $type )
Creates the specified field type object; used for validation and templating.
Description
Parameters
- $type
-
(Required) Type of profile field to create. See bp_xprofile_get_field_types() for default core values.
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
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; } }
Changelog
Version | Description |
---|---|
BuddyPress 2.0.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.