BP_XProfile_Field::fill_data( array|object $args )

Fill object vars based on data passed to the method.


Description Description


Parameters Parameters

$args

(Required) Array or object representing the BP_XProfile_Field properties. Generally, this is a row from the fields database table.


Top ↑

Source Source

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

	public function fill_data( $args ) {
		if ( is_object( $args ) ) {
			$args = (array) $args;
		}

		$int_fields = array(
			'id', 'is_required', 'group_id', 'parent_id', 'is_default_option',
			'field_order', 'option_order', 'can_delete'
		);

		foreach ( $args as $k => $v ) {
			if ( 'name' === $k || 'description' === $k ) {
				$v = stripslashes( $v );
			}

			// Cast numeric strings as integers.
			if ( true === in_array( $k, $int_fields ) ) {
				$v = (int) $v;
			}

			$this->{$k} = $v;
		}

		// Create the field type and store a reference back to this object.
		$this->type_obj            = bp_xprofile_create_field_type( $this->type );
		$this->type_obj->field_obj = $this;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.4.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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