Tribe__Repository::all()
{@inheritdoc}
Source
File: src/Tribe/Repository.php
public function all() {
if ( $this->void_query ) {
return array();
}
$query = $this->build_query();
$return_ids = 'ids' === $query->get( 'fields', '' );
/**
* Do not skip counting the rows if we have some filtering to do on
* `found_posts`.
*/
$query->set( 'no_found_rows', $this->skip_found_rows );
// we'll let the class build the items later
$query->set( 'fields', 'ids' );
/**
* Filters the query object by reference before getting the posts.
*
* @since 4.7.19
*
* @param WP_Query $query
*/
do_action_ref_array( "{$this->filter_name}_pre_get_posts", array( &$query ) );
$results = $query->get_posts();
/**
* Allow extending classes to customize the return value.
* Since we are filtering the array returning empty values while formatting
* the item will exclude it from the return values.
*/
return $return_ids
? $results
: array_filter( array_map( array( $this, 'format_item' ), $results ) );
}