bp_profile_repeater_is_data_valid_for_template_fields( boolean $validated, array $values, BP_XProfile_Field_Type $field_type_obj )
Description
Parameters
- $validated
-
(boolean) (Required)
- $values
-
(array) (Required)
- $field_type_obj
-
(BP_XProfile_Field_Type) (Required)
Source
File: bp-xprofile/bp-xprofile-repeaters.php
function bp_profile_repeater_is_data_valid_for_template_fields ( $validated, $values, $field_type_obj ) { global $bp_profile_repeater_last_field; if ( empty( $bp_profile_repeater_last_field ) ) { return $validated; } if ( $validated ) { $bp_profile_repeater_last_field = false;//reset return $validated; } $field_id = $bp_profile_repeater_last_field->id; $field_group_id = $bp_profile_repeater_last_field->group_id; $is_repeater_enabled = 'on' == bp_xprofile_get_meta( $field_group_id, 'group', 'is_repeater_enabled' ) ? true : false; if ( !$is_repeater_enabled ) { $bp_profile_repeater_last_field = false;//reset return $validated; } $cloned_from = bp_xprofile_get_meta( $field_id, 'field', '_cloned_from', true ); if ( !empty( $cloned_from ) ) { //This is a clone field. We needn't do anything $bp_profile_repeater_last_field = false;//reset return $validated; } //This is a template field $values_arr = explode( ' ', $values ); // If there's a whitelist set, make sure that each value is a whitelisted value. $validation_whitelist = $field_type_obj->get_whitelist_values(); if ( ! empty( $validation_whitelist ) ) { $values_valid = true; foreach ( (array) $values_arr as $value ) { if ( ! in_array( $value, $validation_whitelist ) ) { $values_valid = false; break; } } $validated = $values_valid; } $bp_profile_repeater_last_field = false;//reset return $validated; }
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.