BP_XProfile_Field_Type::get_edit_field_html_elements( array $properties = array() )

Get a sanitised and escaped string of the edit field’s HTML elements and attributes.

Description

Must be used inside the bp_profile_fields() template loop. This method was intended to be static but couldn’t be because php.net/lsb/ requires PHP >= 5.3.

Parameters

$properties

(array) (Optional) key/value array of attributes for this edit field.

Default value: array()

Return

(string)

Source

File: bp-xprofile/classes/class-bp-xprofile-field-type.php

	protected function get_edit_field_html_elements( array $properties = array() ) {

		$r = bp_parse_args( $properties, array(
			'id'   => bp_get_the_profile_field_input_name(),
			'name' => bp_get_the_profile_field_input_name(),
		) );

		if ( bp_get_the_profile_field_is_required() ) {
			$r['aria-required'] = 'true';

			// Moderators can bypass field requirements.
			//if ( ! bp_current_user_can( 'bp_moderate' ) ) {
				//$r[] = 'required';
			//}
		}

		/**
		 * Filters the edit html elements and attributes.
		 *
		 * @since BuddyPress 2.0.0
		 *
		 * @param array  $r     Array of parsed arguments.
		 * @param string $value Class name for the current class instance.
		 */
		$r = (array) apply_filters( 'bp_xprofile_field_edit_html_elements', $r, get_class( $this ) );

		return bp_get_form_field_attributes( sanitize_key( bp_get_the_profile_field_name() ), $r );
	}

Changelog

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.