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

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


Description 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.


Top ↑

Parameters Parameters

$properties

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

Default value: array()


Top ↑

Return Return

(string)


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


Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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