BP_XProfile_Field::fill_data( array|object $args )

Fill object vars based on data passed to the method.

Description

Parameters

$args

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

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

Changelog

Changelog
Version Description
BuddyPress 2.4.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.