bp_xprofile_is_richtext_enabled_for_field( int|null $field_id = null )

Is rich text enabled for this profile field?


Description Description

By default, rich text is enabled for textarea fields and disabled for all other field types.


Top ↑

Parameters Parameters

$field_id

(int|null) (Optional) Default current field ID.

Default value: null


Top ↑

Return Return

(bool)


Source 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, null, false );

	$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 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 );
}


Top ↑

Changelog Changelog

Changelog
Version Description
2.4.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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