bp_xprofile_is_richtext_enabled_for_field( int|null $field_id = null )
Is rich text enabled for this profile field?
Description
By default, rich text is enabled for textarea fields and disabled for all other field types.
Parameters
- $field_id
-
(Optional) Default current field ID.
Default value: null
Return
(bool)
Source
File: bp-xprofile/bp-xprofile-functions.php
function bp_xprofile_is_richtext_enabled_for_field( $field_id = null ) {
if ( ! $field_id ) {
$field_id = bp_get_the_profile_field_id();
}
$field = xprofile_get_field( $field_id );
$enabled = false;
if ( $field instanceof BP_XProfile_Field ) {
$enabled = (bool) $field->type_obj->supports_richtext;
}
/**
* Filters whether richtext is enabled for the given field.
*
* @since BuddyPress 2.4.0
*
* @param bool $enabled True if richtext is enabled for the field, otherwise false.
* @param int $field_id ID of the field.
*/
return apply_filters( 'bp_xprofile_is_richtext_enabled_for_field', $enabled, $field_id );
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 2.4.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.