BP_XProfile_Field_Type::set_allowed_values( string|array $values )

Add a value to this type’s list of allowed values that profile data will be asserted against.


Description Description

You can call this method multiple times to set multiple formats. When validation is performed, it’s successful as long as the new value matches any one of the registered formats.


Top ↑

Parameters Parameters

$values

(string|array) (Required) Allowed values.


Top ↑

Return Return

(BP_XProfile_Field_Type)


Source Source

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

	public function set_allowed_values( $values ) {
		foreach ( (array) $values as $value ) {

			/**
			 * Filters values for field type's list of allowed values that profile data will be asserted against.
			 *
			 * @since 2.0.0
			 * @deprecated 7.0.0 Use 'bp_xprofile_field_type_set_allowed_values' instead.
			 *
			 * @param string                 $value  Field value.
			 * @param array                  $values Original array of values.
			 * @param BP_XProfile_Field_Type $this   Current instance of the BP_XProfile_Field_Type class.
			 */
			$this->validation_allowed_values[] = apply_filters_deprecated( 'bp_xprofile_field_type_set_whitelist_values', array( $value, $values, $this ), '7.0.0', 'bp_xprofile_field_type_set_allowed_values' );

			/**
			 * Filters values for field type's list of allowed values that profile data will be asserted against.
			 *
			 * @since 7.0.0
			 *
			 * @param string                 $value  Field value.
			 * @param array                  $values Original array of values.
			 * @param BP_XProfile_Field_Type $this   Current instance of the BP_XProfile_Field_Type class.
			 */
			$this->validation_allowed_values[] = apply_filters( 'bp_xprofile_field_type_set_allowed_values', $value, $values, $this );
		}

		return $this;
	}


Top ↑

Changelog Changelog

Changelog
Version Description
7.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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