protected function add_additional_fields_to_object( $object, $request ) {

		$additional_fields = $this->get_additional_fields();

		foreach ( $additional_fields as $field_name => $field_options ) {

			if ( ! $field_options['get_callback'] ) {
				continue;
			}

			$object[ $field_name ] = call_user_func( $field_options['get_callback'], $object, $field_name, $request, $this->get_object_type() );
		}

		return $object;
	}
protected function add_additional_fields_to_object( $object, $request ) {

		$additional_fields = $this->get_additional_fields();

		foreach ( $additional_fields as $field_name => $field_options ) {

			if ( ! $field_options['get_callback'] ) {
				continue;
			}

			$object[ $field_name ] = call_user_func( $field_options['get_callback'], $object, $field_name, $request, $this->get_object_type() );
		}

		return $object;
	}
protected function add_additional_fields_to_object ( $ object , $ request ) { $ additional_fields = $ this -> get_additional_fields ( ) ; foreach ( $ additional_fields as $ field_name => $ field_options ) { if ( ! $ field_options [ 'get_callback' ] ) { continue ; } $ object [ $ field_name ] = call_user_func ( $ field_options [ 'get_callback' ] , $ object , $ field_name , $ request , $ this -> get_object_type ( ) ) ; } return $ object ; }
Add the values from additional fields to a data object.

@param array  $object
@param WP_REST_Request $request
@return array modified object with additional fields.
Add the values from additional fields to a data object .