bp_xprofile_is_richtext_enabled_for_field

Is rich text enabled for this profile field?.

Description

bp_xprofile_is_richtext_enabled_for_field( (null) $field_id = null ); 

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

Parameters (1)

0. $field_id — Optional. (null) => null
Default current field ID.

Usage

  1. if ( !function_exists( 'bp_xprofile_is_richtext_enabled_for_field' ) ) { 
  2. require_once '/bp-xprofile/bp-xprofile-functions.php'; 
  3.  
  4. // Optional. Default current field ID. 
  5. $field_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bp_xprofile_is_richtext_enabled_for_field($field_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/bp-xprofile/bp-xprofile-functions.php  
  1. function bp_xprofile_is_richtext_enabled_for_field( $field_id = null ) { 
  2. if ( ! $field_id ) { 
  3. $field_id = bp_get_the_profile_field_id(); 
  4.  
  5. $field = xprofile_get_field( $field_id ); 
  6.  
  7. $enabled = false; 
  8. if ( $field instanceof BP_XProfile_Field ) { 
  9. $enabled = (bool) $field->type_obj->supports_richtext; 
  10.  
  11. /** 
  12. * Filters whether richtext is enabled for the given field. 
  13. * @since 2.4.0 
  14. * @param bool $enabled True if richtext is enabled for the field, otherwise false. 
  15. * @param int $field_id ID of the field. 
  16. */ 
  17. return apply_filters( 'bp_xprofile_is_richtext_enabled_for_field', $enabled, $field_id );