classes/PodsAPI.php
public function load_object( $params, $strict = false ) {

		if ( is_object( $params ) && isset( $params->post_title ) ) {
			$_object = get_object_vars( $params );
		} else {
			$params = (object) pods_sanitize( $params );

			if ( ! isset( $params->type ) || empty( $params->type ) ) {
				return pods_error( __( 'Object type is required', 'pods' ), $this );
			}

			if ( ( ! isset( $params->id ) || empty( $params->id ) ) && ( ! isset( $params->name ) || empty( $params->name ) ) ) {
				return pods_error( __( 'Either Object ID or Name are required', 'pods' ), $this );
			}

			/**
			 * @var $wpdb wpdb
			 */
			global $wpdb;

			if ( isset( $params->name ) ) {
				$_object = pods_by_title( $params->name, ARRAY_A, '_pods_' . $params->type, 'publish' );
			} else {
				$object = $params->id;

				$_object = get_post( $object, ARRAY_A );
			}

			if ( empty( $_object ) ) {
				if ( $strict ) {
					return pods_error( __( 'Object not found', 'pods' ), $this );
				}

				return false;
			}
		}

		$object = array(
			'id'   => $_object['ID'],
			'name' => $_object['post_title'],
			'code' => $_object['post_content'],
			'type' => str_replace( '_pods_', '', $_object['post_type'] ),
			'slug' => $_object['post_name']
		);

		$object['options'] = get_post_meta( $object['id'] );

		foreach ( $object['options'] as $option => &$value ) {
			if ( is_array( $value ) && 1 == count( $value ) ) {
				$value = current( $value );
			}
		}

		return $object;
	}
public function load_object( $params, $strict = false ) {

		if ( is_object( $params ) && isset( $params->post_title ) ) {
			$_object = get_object_vars( $params );
		} else {
			$params = (object) pods_sanitize( $params );

			if ( ! isset( $params->type ) || empty( $params->type ) ) {
				return pods_error( __( 'Object type is required', 'pods' ), $this );
			}

			if ( ( ! isset( $params->id ) || empty( $params->id ) ) && ( ! isset( $params->name ) || empty( $params->name ) ) ) {
				return pods_error( __( 'Either Object ID or Name are required', 'pods' ), $this );
			}

			/**
			 * @var $wpdb wpdb
			 */
			global $wpdb;

			if ( isset( $params->name ) ) {
				$_object = pods_by_title( $params->name, ARRAY_A, '_pods_' . $params->type, 'publish' );
			} else {
				$object = $params->id;

				$_object = get_post( $object, ARRAY_A );
			}

			if ( empty( $_object ) ) {
				if ( $strict ) {
					return pods_error( __( 'Object not found', 'pods' ), $this );
				}

				return false;
			}
		}

		$object = array(
			'id'   => $_object['ID'],
			'name' => $_object['post_title'],
			'code' => $_object['post_content'],
			'type' => str_replace( '_pods_', '', $_object['post_type'] ),
			'slug' => $_object['post_name']
		);

		$object['options'] = get_post_meta( $object['id'] );

		foreach ( $object['options'] as $option => &$value ) {
			if ( is_array( $value ) && 1 == count( $value ) ) {
				$value = current( $value );
			}
		}

		return $object;
	}
public function load_object ( $ params , $ strict = false ) { if ( is_object ( $ params ) && isset ( $ params -> post_title ) ) { $ _object = get_object_vars ( $ params ) ; } else { $ params = ( object ) pods_sanitize ( $ params ) ; if ( ! isset ( $ params -> type ) || empty ( $ params -> type ) ) { return pods_error ( __ ( 'Object type is required' , 'pods' ) , $ this ) ; } if ( ( ! isset ( $ params -> id ) || empty ( $ params -> id ) ) && ( ! isset ( $ params -> name ) || empty ( $ params -> name ) ) ) { return pods_error ( __ ( 'Either Object ID or Name are required' , 'pods' ) , $ this ) ; } /**
			 * @var $wpdb wpdb
			 */ global $ wpdb ; if ( isset ( $ params -> name ) ) { $ _object = pods_by_title ( $ params -> name , ARRAY_A , '_pods_' . $ params -> type , 'publish' ) ; } else { $ object = $ params -> id ; $ _object = get_post ( $ object , ARRAY_A ) ; } if ( empty ( $ _object ) ) { if ( $ strict ) { return pods_error ( __ ( 'Object not found' , 'pods' ) , $ this ) ; } return false ; } } $ object = array ( 'id' => $ _object [ 'ID' ] , 'name' => $ _object [ 'post_title' ] , 'code' => $ _object [ 'post_content' ] , 'type' => str_replace ( '_pods_' , '' , $ _object [ 'post_type' ] ) , 'slug' => $ _object [ 'post_name' ] ) ; $ object [ 'options' ] = get_post_meta ( $ object [ 'id' ] ) ; foreach ( $ object [ 'options' ] as $ option => & $ value ) { if ( is_array ( $ value ) && 1 == count ( $ value ) ) { $ value = current ( $ value ) ; } } return $ object ; }
Load a Pods Object

$params['id'] int The Object ID
$params['name'] string The Object name
$params['type'] string The Object type

@param array|object $params An associative array of parameters
@param bool         $strict

@return array|bool
@since 2.0.0
Load a Pods Object