protected function get_items( $settings ) {
		if ( is_array( $settings->items ) && ! empty( $settings->items ) ) {
			$mapping = function ( $item ) {
				return is_array( $item ) ?
					isset( $item['id'], $item['title'] ) :
					isset( $item->id, $item->title );
			};

			return array_map(
				'papi_maybe_convert_to_object',
				array_filter( $settings->items, $mapping )
			);
		}

		// By default we add posts per page key with the value -1 (all).
		if ( ! isset( $settings->query['posts_per_page'] ) ) {
			$settings->query['posts_per_page'] = -1;
		}

		// Prepare arguments for WP_Query.
		$args = array_merge( [
			'post_status'            => 'any',
			'post_type'              => papi_to_array( $settings->post_type ),
			'no_found_rows'          => true,
			'update_post_meta_cache' => false,
			'update_post_term_cache' => false
		], $settings->query );

		$items = ( new WP_Query( $args ) )->posts;

		return array_map( [$this, 'convert_post_to_item'], papi_get_only_objects( $items ) );
	}
protected function get_items( $settings ) {
		if ( is_array( $settings->items ) && ! empty( $settings->items ) ) {
			$mapping = function ( $item ) {
				return is_array( $item ) ?
					isset( $item['id'], $item['title'] ) :
					isset( $item->id, $item->title );
			};

			return array_map(
				'papi_maybe_convert_to_object',
				array_filter( $settings->items, $mapping )
			);
		}

		// By default we add posts per page key with the value -1 (all).
		if ( ! isset( $settings->query['posts_per_page'] ) ) {
			$settings->query['posts_per_page'] = -1;
		}

		// Prepare arguments for WP_Query.
		$args = array_merge( [
			'post_status'            => 'any',
			'post_type'              => papi_to_array( $settings->post_type ),
			'no_found_rows'          => true,
			'update_post_meta_cache' => false,
			'update_post_term_cache' => false
		], $settings->query );

		$items = ( new WP_Query( $args ) )->posts;

		return array_map( [$this, 'convert_post_to_item'], papi_get_only_objects( $items ) );
	}
protected function get_items ( $ settings ) { if ( is_array ( $ settings -> items ) && ! empty ( $ settings -> items ) ) { $ mapping = function ( $ item ) { return is_array ( $ item ) ? isset ( $ item [ 'id' ] , $ item [ 'title' ] ) : isset ( $ item -> id , $ item -> title ) ; } ; return array_map ( 'papi_maybe_convert_to_object' , array_filter ( $ settings -> items , $ mapping ) ) ; } // By default we add posts per page key with the value -1 (all). if ( ! isset ( $ settings -> query [ 'posts_per_page' ] ) ) { $ settings -> query [ 'posts_per_page' ] = - 1 ; } // Prepare arguments for WP_Query. $ args = array_merge ( [ 'post_status' => 'any' , 'post_type' => papi_to_array ( $ settings -> post_type ) , 'no_found_rows' => true , 'update_post_meta_cache' => false , 'update_post_term_cache' => false ] , $ settings -> query ) ; $ items = ( new WP_Query ( $ args ) ) -> posts ; return array_map ( [ $ this , 'convert_post_to_item' ] , papi_get_only_objects ( $ items ) ) ; }
Get items to display from settings.

@param  stdClass $settings

@return array
Get items to display from settings .